{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}J:\jgottlieb\Dropbox\Research\Disseminators\Benin\Drafts\JEPS\AGKM JEPS replication files\JEPS.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res} 5 Nov 2018, 10:49:03
{txt}
{com}. 
. ** Install coefplot
. cap ssc install coefplot
{txt}
{com}. 
. ********************************************************************************
. set more off
{txt}
{com}. 
. ********************************************************
. *Load and define adminstrative data
. 
. use "merged_administrative_5.dta", clear
{txt}
{com}. 
. ** Or regenerate merged data file
. *qui do "working_data/merging_administrative_v2.do"
. 
. 
. keep if merge2015==3
{txt}(4,364 observations deleted)

{com}. 
. ************************
. 
. replace condition="Control" if condition=="control"
{txt}(1,129 real changes made)

{com}. replace condition="Control" if condition==""
{txt}(0 real changes made)

{com}. 
. drop treatment 
{txt}
{com}. gen treatment=0
{txt}
{com}. replace treatment=1 if condition!="Control" 
{txt}(193 real changes made)

{com}. 
. replace block = 4 if dosage==0 // villages in low dose all in same block
{txt}(658 real changes made)

{com}. 
. egen blid = group(commune block)  // generate block that combines block/commune
{txt}
{com}. 
. rename turnout survey_turnout
{res}{txt}
{com}. generate turnout=(total_valid+total_annulees)/regvoters
{txt}
{com}. label var turnout "Voter turnout"
{txt}
{com}. replace turnout=. if turnout>1 //31 Control villages and 1 T2T4
{txt}(32 real changes made, 32 to missing)

{com}. 
. generate public=0 
{txt}
{com}.         replace public=1 if condition=="T1T4" | condition=="T2T4"
{txt}(103 real changes made)

{com}. generate civics=0 
{txt}
{com}.         replace civics=1 if condition=="T2T3" | condition=="T2T4"
{txt}(105 real changes made)

{com}. gen private=0
{txt}
{com}.         replace private=1 if condition=="T1T3" | condition=="T2T3"
{txt}(90 real changes made)

{com}. gen infoonly=0
{txt}
{com}.         replace infoonly=1 if condition=="T1T3" | condition=="T1T4"
{txt}(88 real changes made)

{com}. 
. 
. ******************************************************************************
. 
. gen official_vote = incumbent_share
{txt}(5 missing values generated)

{com}. gen survey_vote = incumbent_vote
{txt}(1,085 missing values generated)

{com}. 
. gen official_turnout = turnout
{txt}(32 missing values generated)

{com}. 
. label variable official_vote "Voteshare Official Data"
{txt}
{com}. label variable survey_v "Voteshare Survey Data"
{txt}
{com}. label variable official_turnout "Turnout Official Data"
{txt}
{com}. label variable survey_turn "Turnout Survey Data"
{txt}
{com}. 
. 
. mean official_vote if survey_vote ~=.
{res}
{txt}Mean estimation{col 35}Number of obs{col 51}= {res}       237

{txt}{hline 14}{c TT}{hline 11}{hline 11}{hline 14}{hline 12}
{col 15}{c |}       Mean{col 27}   Std. Err.{col 39}     [95% Con{col 52}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 14}{hline 12}
official_vote {c |}{col 15}{res}{space 2} .3437205{col 27}{space 2} .0142387{col 38}{space 5} .3156693{col 52}{space 3} .3717717
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 14}{hline 12}

{com}. 
. mean survey_vote
{res}
{txt}Mean estimation{col 35}Number of obs{col 51}= {res}       237

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 14}{hline 12}
{col 14}{c |}       Mean{col 26}   Std. Err.{col 38}     [95% Con{col 51}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 14}{hline 12}
{space 1}survey_vote {c |}{col 14}{res}{space 2} .4988945{col 26}{space 2} .0181745{col 37}{space 5} .4630895{col 51}{space 3} .5346995
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 14}{hline 12}

{com}. 
. 
. mean official_turnout if survey_turnout ~=.
{res}
{txt}Mean estimation{col 35}Number of obs{col 51}= {res}       234

{txt}{hline 17}{c TT}{hline 11}{hline 11}{hline 14}{hline 12}
{col 18}{c |}       Mean{col 30}   Std. Err.{col 42}     [95% Con{col 55}f. Interval]
{hline 17}{c +}{hline 11}{hline 11}{hline 14}{hline 12}
official_turnout {c |}{col 18}{res}{space 2} .6962491{col 30}{space 2} .0070169{col 41}{space 5} .6824244{col 55}{space 3} .7100738
{txt}{hline 17}{c BT}{hline 11}{hline 11}{hline 14}{hline 12}

{com}. 
. mean survey_turnout
{res}
{txt}Mean estimation{col 35}Number of obs{col 51}= {res}       237

{txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 14}{hline 12}
{col 16}{c |}       Mean{col 28}   Std. Err.{col 40}     [95% Con{col 53}f. Interval]
{hline 15}{c +}{hline 11}{hline 11}{hline 14}{hline 12}
survey_turnout {c |}{col 16}{res}{space 2} .9011378{col 28}{space 2} .0075371{col 39}{space 5} .8862893{col 53}{space 3} .9159864
{txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 14}{hline 12}

{com}. 
. 
. *******************************************
. ** Explore causes of deviation
. 
. * Define deviation as difference between survey and admin outcome
. gen deviation = survey_vote-official_vote
{txt}(1,085 missing values generated)

{com}. 
. gen deviationt = survey_t-official_t
{txt}(1,088 missing values generated)

{com}. 
. gen deviationsq=deviation^2
{txt}(1,085 missing values generated)

{com}. gen deviationtsq=deviationt^2
{txt}(1,088 missing values generated)

{com}.                         
. * Treatment and deviation
. regress deviation treatment 

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       237
{txt}{hline 13}{c +}{hline 34}   F(1, 235)       = {res}     0.22
{txt}       Model {c |} {res} .015426574         1  .015426574   {txt}Prob > F        ={res}    0.6409
{txt}    Residual {c |} {res} 16.6190247       235  .070719254   {txt}R-squared       ={res}    0.0009
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0033
{txt}       Total {c |} {res} 16.6344513       236  .070484963   {txt}Root MSE        =   {res} .26593

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   deviation{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2}-.0191114{col 26}{space 2} .0409191{col 37}{space 1}   -0.47{col 46}{space 3}0.641{col 54}{space 4}-.0997265{col 67}{space 3} .0615037
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1698503{col 26}{space 2} .0358581{col 37}{space 1}    4.74{col 46}{space 3}0.000{col 54}{space 4} .0992059{col 67}{space 3} .2404947
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviation treatment if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       135
{txt}{hline 13}{c +}{hline 34}   F(1, 133)       = {res}     0.54
{txt}       Model {c |} {res} .035456123         1  .035456123   {txt}Prob > F        ={res}    0.4653
{txt}    Residual {c |} {res} 8.79302972       133  .066113005   {txt}R-squared       ={res}    0.0040
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0035
{txt}       Total {c |} {res} 8.82848585       134  .065884223   {txt}Root MSE        =   {res} .25712

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   deviation{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2} .0385314{col 26}{space 2} .0526154{col 37}{space 1}    0.73{col 46}{space 3}0.465{col 54}{space 4}-.0655398{col 67}{space 3} .1426026
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1629225{col 26}{space 2} .0461809{col 37}{space 1}    3.53{col 46}{space 3}0.001{col 54}{space 4} .0715785{col 67}{space 3} .2542666
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviation treatment if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       102
{txt}{hline 13}{c +}{hline 34}   F(1, 100)       = {res}     2.33
{txt}       Model {c |} {res} .168014175         1  .168014175   {txt}Prob > F        ={res}    0.1297
{txt}    Residual {c |} {res} 7.19844308       100  .071984431   {txt}R-squared       ={res}    0.0228
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0130
{txt}       Total {c |} {res} 7.36645725       101   .07293522   {txt}Root MSE        =   {res}  .2683

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   deviation{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2}-.0956798{col 26}{space 2} .0626277{col 37}{space 1}   -1.53{col 46}{space 3}0.130{col 54}{space 4}-.2199313{col 67}{space 3} .0285718
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1787986{col 26}{space 2} .0547663{col 37}{space 1}    3.26{col 46}{space 3}0.002{col 54}{space 4} .0701438{col 67}{space 3} .2874535
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}.                         
. regress deviationt treatment 

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       234
{txt}{hline 13}{c +}{hline 34}   F(1, 232)       = {res}     0.70
{txt}       Model {c |} {res}  .02065195         1   .02065195   {txt}Prob > F        ={res}    0.4048
{txt}    Residual {c |} {res} 6.87755706       232  .029644642   {txt}R-squared       ={res}    0.0030
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0013
{txt}       Total {c |} {res} 6.89820901       233  .029606047   {txt}Root MSE        =   {res} .17218

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  deviationt{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2} .0224446{col 26}{space 2} .0268908{col 37}{space 1}    0.83{col 46}{space 3}0.405{col 54}{space 4}-.0305368{col 67}{space 3}  .075426
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1872658{col 26}{space 2} .0236502{col 37}{space 1}    7.92{col 46}{space 3}0.000{col 54}{space 4} .1406692{col 67}{space 3} .2338625
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviationt treatment if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       133
{txt}{hline 13}{c +}{hline 34}   F(1, 131)       = {res}     0.07
{txt}       Model {c |} {res} .002560647         1  .002560647   {txt}Prob > F        ={res}    0.7928
{txt}    Residual {c |} {res} 4.84327877       131  .036971594   {txt}R-squared       ={res}    0.0005
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0071
{txt}       Total {c |} {res} 4.84583941       132  .036710905   {txt}Root MSE        =   {res} .19228

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  deviationt{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2}-.0104984{col 26}{space 2} .0398915{col 37}{space 1}   -0.26{col 46}{space 3}0.793{col 54}{space 4}-.0894133{col 67}{space 3} .0684166
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2102717{col 26}{space 2} .0351054{col 37}{space 1}    5.99{col 46}{space 3}0.000{col 54}{space 4} .1408249{col 67}{space 3} .2797185
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviationt treatment if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       101
{txt}{hline 13}{c +}{hline 34}   F(1, 99)        = {res}     3.83
{txt}       Model {c |} {res} .076377869         1  .076377869   {txt}Prob > F        ={res}    0.0531
{txt}    Residual {c |} {res} 1.97408825        99  .019940285   {txt}R-squared       ={res}    0.0372
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0275
{txt}       Total {c |} {res} 2.05046612       100  .020504661   {txt}Root MSE        =   {res} .14121

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  deviationt{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2} .0655742{col 26}{space 2} .0335054{col 37}{space 1}    1.96{col 46}{space 3}0.053{col 54}{space 4}-.0009078{col 67}{space 3} .1320563
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1572582{col 26}{space 2} .0294443{col 37}{space 1}    5.34{col 46}{space 3}0.000{col 54}{space 4} .0988343{col 67}{space 3} .2156822
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. 
. * Attrition and deviation
. *To get attrition in data, rerun balance_attrition.do with attrition at village level
. *Re-run merging_administrative_v2.do which uses the survey_village_level data
. *Also undo the drop merge at the top to see how bad the mismatch in sample is across survey and official data
. 
. regress deviation attrition 

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       237
{txt}{hline 13}{c +}{hline 34}   F(1, 235)       = {res}     0.19
{txt}       Model {c |} {res} .013707442         1  .013707442   {txt}Prob > F        ={res}    0.6602
{txt}    Residual {c |} {res} 16.6207439       235   .07072657   {txt}R-squared       ={res}    0.0008
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0034
{txt}       Total {c |} {res} 16.6344513       236  .070484963   {txt}Root MSE        =   {res} .26594

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   deviation{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}attrition {c |}{col 14}{res}{space 2}-.0381251{col 26}{space 2} .0866012{col 37}{space 1}   -0.44{col 46}{space 3}0.660{col 54}{space 4}-.2087391{col 67}{space 3} .1324889
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1709332{col 26}{space 2} .0397473{col 37}{space 1}    4.30{col 46}{space 3}0.000{col 54}{space 4} .0926266{col 67}{space 3} .2492399
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviation attrition if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       135
{txt}{hline 13}{c +}{hline 34}   F(1, 133)       = {res}     3.88
{txt}       Model {c |} {res} .250274167         1  .250274167   {txt}Prob > F        ={res}    0.0509
{txt}    Residual {c |} {res} 8.57821168       133  .064497832   {txt}R-squared       ={res}    0.0283
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0210
{txt}       Total {c |} {res} 8.82848585       134  .065884223   {txt}Root MSE        =   {res} .25396

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   deviation{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}attrition {c |}{col 14}{res}{space 2}-.1993598{col 26}{space 2} .1012051{col 37}{space 1}   -1.97{col 46}{space 3}0.051{col 54}{space 4}-.3995395{col 67}{space 3} .0008198
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .2805516{col 26}{space 2} .0497091{col 37}{space 1}    5.64{col 46}{space 3}0.000{col 54}{space 4}  .182229{col 67}{space 3} .3788743
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviation attrition_vote if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       135
{txt}{hline 13}{c +}{hline 34}   F(1, 133)       = {res}     0.65
{txt}       Model {c |} {res} .042726645         1  .042726645   {txt}Prob > F        ={res}    0.4227
{txt}    Residual {c |} {res}  8.7857592       133   .06605834   {txt}R-squared       ={res}    0.0048
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0026
{txt}       Total {c |} {res} 8.82848585       134  .065884223   {txt}Root MSE        =   {res} .25702

{txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}     deviation{col 16}{c |}      Coef.{col 28}   Std. Err.{col 40}      t{col 48}   P>|t|{col 56}     [95% Con{col 69}f. Interval]
{hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
attrition_vote {c |}{col 16}{res}{space 2}-.0941351{col 28}{space 2} .1170485{col 39}{space 1}   -0.80{col 48}{space 3}0.423{col 56}{space 4}-.3256524{col 69}{space 3} .1373823
{txt}{space 9}_cons {c |}{col 16}{res}{space 2} .2404566{col 28}{space 2}  .063477{col 39}{space 1}    3.79{col 48}{space 3}0.000{col 56}{space 4} .1149016{col 69}{space 3} .3660116
{txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviation attrition if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       102
{txt}{hline 13}{c +}{hline 34}   F(1, 100)       = {res}     1.55
{txt}       Model {c |} {res} .112219086         1  .112219086   {txt}Prob > F        ={res}    0.2165
{txt}    Residual {c |} {res} 7.25423816       100  .072542382   {txt}R-squared       ={res}    0.0152
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0054
{txt}       Total {c |} {res} 7.36645725       101   .07293522   {txt}Root MSE        =   {res} .26934

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   deviation{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}attrition {c |}{col 14}{res}{space 2}  .197012{col 26}{space 2}    .1584{col 37}{space 1}    1.24{col 46}{space 3}0.216{col 54}{space 4}-.1172491{col 67}{space 3} .5112732
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .0314411{col 26}{space 2} .0653402{col 37}{space 1}    0.48{col 46}{space 3}0.631{col 54}{space 4}-.0981921{col 67}{space 3} .1610742
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviation attrition_vote if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       102
{txt}{hline 13}{c +}{hline 34}   F(1, 100)       = {res}     0.49
{txt}       Model {c |} {res} .035704583         1  .035704583   {txt}Prob > F        ={res}    0.4869
{txt}    Residual {c |} {res} 7.33075267       100  .073307527   {txt}R-squared       ={res}    0.0048
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0051
{txt}       Total {c |} {res} 7.36645725       101   .07293522   {txt}Root MSE        =   {res} .27075

{txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}     deviation{col 16}{c |}      Coef.{col 28}   Std. Err.{col 40}      t{col 48}   P>|t|{col 56}     [95% Con{col 69}f. Interval]
{hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
attrition_vote {c |}{col 16}{res}{space 2} .1178577{col 28}{space 2} .1688769{col 39}{space 1}    0.70{col 48}{space 3}0.487{col 56}{space 4}-.2171893{col 69}{space 3} .4529047
{txt}{space 9}_cons {c |}{col 16}{res}{space 2}   .05323{col 28}{space 2} .0797282{col 39}{space 1}    0.67{col 48}{space 3}0.506{col 56}{space 4}-.1049485{col 69}{space 3} .2114085
{txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. 
. regress deviationt attrition 

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       234
{txt}{hline 13}{c +}{hline 34}   F(1, 232)       = {res}    14.26
{txt}       Model {c |} {res} .399373247         1  .399373247   {txt}Prob > F        ={res}    0.0002
{txt}    Residual {c |} {res} 6.49883576       232  .028012223   {txt}R-squared       ={res}    0.0579
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0538
{txt}       Total {c |} {res} 6.89820901       233  .029606047   {txt}Root MSE        =   {res} .16737

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  deviationt{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}attrition {c |}{col 14}{res}{space 2} .2076779{col 26}{space 2} .0550015{col 37}{space 1}    3.78{col 46}{space 3}0.000{col 54}{space 4} .0993116{col 67}{space 3} .3160441
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1184723{col 26}{space 2} .0253048{col 37}{space 1}    4.68{col 46}{space 3}0.000{col 54}{space 4} .0686157{col 67}{space 3}  .168329
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviationt attrition if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       133
{txt}{hline 13}{c +}{hline 34}   F(1, 131)       = {res}    14.77
{txt}       Model {c |} {res}  .49108478         1   .49108478   {txt}Prob > F        ={res}    0.0002
{txt}    Residual {c |} {res} 4.35475463       131  .033242402   {txt}R-squared       ={res}    0.1013
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0945
{txt}       Total {c |} {res} 4.84583941       132  .036710905   {txt}Root MSE        =   {res} .18232

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  deviationt{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}attrition {c |}{col 14}{res}{space 2} .2816705{col 26}{space 2}  .073284{col 37}{space 1}    3.84{col 46}{space 3}0.000{col 54}{space 4} .1366972{col 67}{space 3} .4266438
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .0775858{col 26}{space 2} .0360572{col 37}{space 1}    2.15{col 46}{space 3}0.033{col 54}{space 4} .0062561{col 67}{space 3} .1489155
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviationt attrition_vote if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       133
{txt}{hline 13}{c +}{hline 34}   F(1, 131)       = {res}     0.27
{txt}       Model {c |} {res} .010060351         1  .010060351   {txt}Prob > F        ={res}    0.6025
{txt}    Residual {c |} {res} 4.83577906       131  .036914344   {txt}R-squared       ={res}    0.0021
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0055
{txt}       Total {c |} {res} 4.84583941       132  .036710905   {txt}Root MSE        =   {res} .19213

{txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}    deviationt{col 16}{c |}      Coef.{col 28}   Std. Err.{col 40}      t{col 48}   P>|t|{col 56}     [95% Con{col 69}f. Interval]
{hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
attrition_vote {c |}{col 16}{res}{space 2}-.0461704{col 28}{space 2} .0884412{col 39}{space 1}   -0.52{col 48}{space 3}0.603{col 56}{space 4}-.2211282{col 69}{space 3} .1287874
{txt}{space 9}_cons {c |}{col 16}{res}{space 2}  .225689{col 28}{space 2} .0480847{col 39}{space 1}    4.69{col 48}{space 3}0.000{col 56}{space 4}  .130566{col 69}{space 3} .3208121
{txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviationt attrition if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       101
{txt}{hline 13}{c +}{hline 34}   F(1, 99)        = {res}     0.69
{txt}       Model {c |} {res}  .01416106         1   .01416106   {txt}Prob > F        ={res}    0.4087
{txt}    Residual {c |} {res} 2.03630506        99  .020568738   {txt}R-squared       ={res}    0.0069
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0031
{txt}       Total {c |} {res} 2.05046612       100  .020504661   {txt}Root MSE        =   {res} .14342

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}  deviationt{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}attrition {c |}{col 14}{res}{space 2} .0706214{col 26}{space 2} .0851123{col 37}{space 1}    0.83{col 46}{space 3}0.409{col 54}{space 4}-.0982599{col 67}{space 3} .2395028
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .1811467{col 26}{space 2} .0352595{col 37}{space 1}    5.14{col 46}{space 3}0.000{col 54}{space 4} .1111843{col 67}{space 3} .2511091
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress deviationt attrition_vote if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       101
{txt}{hline 13}{c +}{hline 34}   F(1, 99)        = {res}     5.49
{txt}       Model {c |} {res} .107719734         1  .107719734   {txt}Prob > F        ={res}    0.0211
{txt}    Residual {c |} {res} 1.94274639        99  .019623701   {txt}R-squared       ={res}    0.0525
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0430
{txt}       Total {c |} {res} 2.05046612       100  .020504661   {txt}Root MSE        =   {res} .14008

{txt}{hline 15}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}    deviationt{col 16}{c |}      Coef.{col 28}   Std. Err.{col 40}      t{col 48}   P>|t|{col 56}     [95% Con{col 69}f. Interval]
{hline 15}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
attrition_vote {c |}{col 16}{res}{space 2}-.2055585{col 28}{space 2} .0877361{col 39}{space 1}   -2.34{col 48}{space 3}0.021{col 56}{space 4}-.3796459{col 69}{space 3}-.0314711
{txt}{space 9}_cons {c |}{col 16}{res}{space 2} .2995892{col 28}{space 2}  .041543{col 39}{space 1}    7.21{col 48}{space 3}0.000{col 56}{space 4} .2171588{col 69}{space 3} .3820195
{txt}{hline 15}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. 
. * Treatment does not predict attrition rates
. regress attrition treatment if goodnews==1

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       144
{txt}{hline 13}{c +}{hline 34}   F(1, 142)       = {res}     0.04
{txt}       Model {c |} {res} .002287816         1  .002287816   {txt}Prob > F        ={res}    0.8490
{txt}    Residual {c |} {res} 8.93004946       142  .062887672   {txt}R-squared       ={res}    0.0003
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}   -0.0068
{txt}       Total {c |} {res} 8.93233728       143  .062463897   {txt}Root MSE        =   {res} .25077

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   attrition{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2} .0095876{col 26}{space 2} .0502667{col 37}{space 1}    0.19{col 46}{space 3}0.849{col 54}{space 4}-.0897801{col 67}{space 3} .1089552
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .4686119{col 26}{space 2}  .044331{col 37}{space 1}   10.57{col 46}{space 3}0.000{col 54}{space 4} .3809779{col 67}{space 3}  .556246
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. regress attrition treatment if goodnews==0

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       107
{txt}{hline 13}{c +}{hline 34}   F(1, 105)       = {res}     1.45
{txt}       Model {c |} {res} .064706392         1  .064706392   {txt}Prob > F        ={res}    0.2309
{txt}    Residual {c |} {res} 4.67897324       105   .04456165   {txt}R-squared       ={res}    0.0136
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.0042
{txt}       Total {c |} {res} 4.74367964       106  .044751695   {txt}Root MSE        =   {res}  .2111

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   attrition{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2}-.0573372{col 26}{space 2} .0475821{col 37}{space 1}   -1.21{col 46}{space 3}0.231{col 54}{space 4}-.1516836{col 67}{space 3} .0370093
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .4491161{col 26}{space 2} .0413994{col 37}{space 1}   10.85{col 46}{space 3}0.000{col 54}{space 4} .3670288{col 67}{space 3} .5312034
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}{txt}
{com}. 
. *******************************************
. ** Show means
. 
. ttest survey_vote=official_vote

{txt}Paired t test
{hline 9}{c TT}{hline 68}
Variable{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
surve~te {c |}{res}{col 12}    237{col 22} .4988945{col 34} .0181745{col 46}  .279793{col 58} .4630895{col 70} .5346995
{txt}offici~e {c |}{res}{col 12}    237{col 22} .3437205{col 34} .0142387{col 46} .2192021{col 58} .3156693{col 70} .3717717
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 12}    237{col 22}  .155174{col 34} .0172454{col 46}   .26549{col 58} .1211994{col 70} .1891487
{txt}{hline 9}{c BT}{hline 68}
     mean(diff) = mean({res}survey_vote{txt} - {res}official_vote{txt})               t = {res}  8.9980
{txt} Ho: mean(diff) = 0                              degrees of freedom = {res}     236

 {txt}Ha: mean(diff) < 0           Ha: mean(diff) != 0           Ha: mean(diff) > 0
 Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0000          {txt}Pr(T > t) = {res}0.0000
{txt}
{com}. ttest survey_t=official_t

{txt}Paired t test
{hline 9}{c TT}{hline 68}
Variable{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
survey~t {c |}{res}{col 12}    234{col 22} .9008759{col 34}  .007613{col 46} .1164559{col 58} .8858769{col 70} .9158749
{txt}offici~t {c |}{res}{col 12}    234{col 22} .6962491{col 34} .0070169{col 46} .1073379{col 58} .6824244{col 70} .7100738
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 12}    234{col 22} .2046268{col 34} .0112482{col 46} .1720641{col 58} .1824657{col 70}  .226788
{txt}{hline 9}{c BT}{hline 68}
     mean(diff) = mean({res}survey_turnout{txt} - {res}official_turnout{txt})         t = {res} 18.1920
{txt} Ho: mean(diff) = 0                              degrees of freedom = {res}     233

 {txt}Ha: mean(diff) < 0           Ha: mean(diff) != 0           Ha: mean(diff) > 0
 Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0000          {txt}Pr(T > t) = {res}0.0000
{txt}
{com}. 
. gen group_name="Official" in 1
{txt}(1,321 missing values generated)

{com}. replace group_name="Survey" in 2
{txt}(1 real change made)

{com}. replace group_name="Official" in 3
{txt}(1 real change made)

{com}. replace group_name="Survey" in 4
{txt}(1 real change made)

{com}. 
. gen voteshare=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen voteshareu=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen votesharec=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen upper=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen upperu=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen upperc=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen lower=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen loweru=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen lowerc=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen sd=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen sdu=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen sdc=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen n=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen nu=. in 1/4
{txt}(1,322 missing values generated)

{com}. gen nc=. in 1/4
{txt}(1,322 missing values generated)

{com}. 
. gen data=. in 1/4
{txt}(1,322 missing values generated)

{com}. replace data=1 if _n==1
{txt}(1 real change made)

{com}. replace data=2 if _n==2
{txt}(1 real change made)

{com}. replace data=1 if _n==3
{txt}(1 real change made)

{com}. replace data=2 if _n==4
{txt}(1 real change made)

{com}. 
. generate Urban="" in 1/4
{txt}(1,322 missing values generated)

{com}. replace Urban="Urban" if _n==1 | _n==2
{txt}variable {bf}Urban{sf} was {bf}{res}str1{sf}{txt} now {bf}{res}str5{sf}
{txt}(2 real changes made)

{com}. replace Urban="Rural" if _n==3 | _n==4
{txt}(2 real changes made)

{com}. 
. generate Competitive="" in 1/4
{txt}(1,322 missing values generated)

{com}. replace Competitive="More competitive" if _n==1 | _n==2
{txt}variable {bf}Competitive{sf} was {bf}{res}str1{sf}{txt} now {bf}{res}str16{sf}
{txt}(2 real changes made)

{com}. replace Competitive="Less competitive" if _n==3 | _n==4
{txt}(2 real changes made)

{com}. 
. label define data 1 "Official" 2 "Survey"
{txt}
{com}. label variable data data
{txt}
{com}. 
. summ official_vote if survey_vote~=., detail

                   {txt}Voteshare Official Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res} .0164745              0
{txt}10%    {res} .0410367              0       {txt}Obs         {res}        237
{txt}25%    {res} .1518987       .0029155       {txt}Sum of Wgt. {res}        237

{txt}50%    {res}  .359322                      {txt}Mean          {res} .3437205
                        {txt}Largest       Std. Dev.     {res} .2192021
{txt}75%    {res} .5221707       .7985075
{txt}90%    {res} .6350877       .8176638       {txt}Variance      {res} .0480496
{txt}95%    {res} .6990595       .8346614       {txt}Skewness      {res} .1646625
{txt}99%    {res} .8176638       .8901099       {txt}Kurtosis      {res} 2.061213
{txt}
{com}. replace voteshare=r(mean) if _n==1
{txt}(1 real change made)

{com}. replace upper=r(p95) if _n==1
{txt}(1 real change made)

{com}. replace lower=r(p5) if _n==1
{txt}(1 real change made)

{com}. replace sd=r(sd) if _n==1
{txt}(1 real change made)

{com}. replace n=r(N) if _n==1
{txt}(1 real change made)

{com}. 
. summ official_vote if survey_vote~=. & urban==1, detail

                   {txt}Voteshare Official Data
{hline 61}
      Percentiles      Smallest
 1%    {res} .0113636       .0113636
{txt} 5%    {res} .0294118       .0155602
{txt}10%    {res} .0361305       .0217391       {txt}Obs         {res}         72
{txt}25%    {res} .1959383       .0294118       {txt}Sum of Wgt. {res}         72

{txt}50%    {res} .4218493                      {txt}Mean          {res}  .389342
                        {txt}Largest       Std. Dev.     {res} .2258227
{txt}75%    {res} .5578991       .7226173
{txt}90%    {res} .6616915       .7438017       {txt}Variance      {res} .0509959
{txt}95%    {res} .7226173       .7569331       {txt}Skewness      {res}-.1686639
{txt}99%    {res} .8901099       .8901099       {txt}Kurtosis      {res} 2.033955
{txt}
{com}. replace voteshareu=r(mean) if _n==1
{txt}(1 real change made)

{com}. replace upperu=r(p95) if _n==1
{txt}(1 real change made)

{com}. replace loweru=r(p5) if _n==1
{txt}(1 real change made)

{com}. replace sdu=r(sd) if _n==1
{txt}(1 real change made)

{com}. replace nu=r(N) if _n==1
{txt}(1 real change made)

{com}. 
. summ official_vote if survey_vote~=. & urban==0, detail

                   {txt}Voteshare Official Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res} .0149533              0
{txt}10%    {res} .0425532              0       {txt}Obs         {res}        163
{txt}25%    {res} .1319958       .0029155       {txt}Sum of Wgt. {res}        163

{txt}50%    {res} .3020134                      {txt}Mean          {res} .3213342
                        {txt}Largest       Std. Dev.     {res} .2140308
{txt}75%    {res} .4935065       .7880597
{txt}90%    {res} .5897436       .7985075       {txt}Variance      {res} .0458092
{txt}95%    {res} .6866953       .8176638       {txt}Skewness      {res} .3354193
{txt}99%    {res} .8176638       .8346614       {txt}Kurtosis      {res} 2.221206
{txt}
{com}. replace voteshareu=r(mean) if _n==3
{txt}(1 real change made)

{com}. replace upperu=r(p95) if _n==3
{txt}(1 real change made)

{com}. replace loweru=r(p5) if _n==3
{txt}(1 real change made)

{com}. replace sdu=r(sd) if _n==3
{txt}(1 real change made)

{com}. replace nu=r(N) if _n==3
{txt}(1 real change made)

{com}. 
. summ official_vote if survey_vote~=. & competitive_margin==1, detail

                   {txt}Voteshare Official Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res} .0217391              0
{txt}10%    {res} .0487805        .004878       {txt}Obs         {res}        111
{txt}25%    {res}  .148368       .0113636       {txt}Sum of Wgt. {res}        111

{txt}50%    {res} .3277027                      {txt}Mean          {res} .3236682
                        {txt}Largest       Std. Dev.     {res} .2033902
{txt}75%    {res} .4920993       .6858169
{txt}90%    {res} .5753968       .6965066       {txt}Variance      {res} .0413676
{txt}95%    {res} .6570397       .6990595       {txt}Skewness      {res}  .111327
{txt}99%    {res} .6990595        .764887       {txt}Kurtosis      {res} 1.889464
{txt}
{com}. replace votesharec=r(mean) if _n==1
{txt}(1 real change made)

{com}. replace upperc=r(p95) if _n==1
{txt}(1 real change made)

{com}. replace lowerc=r(p5) if _n==1
{txt}(1 real change made)

{com}. replace sdc=r(sd) if _n==1
{txt}(1 real change made)

{com}. replace nc=r(N) if _n==1
{txt}(1 real change made)

{com}. 
. summ official_vote if survey_vote~=. & competitive_margin==0, detail

                   {txt}Voteshare Official Data
{hline 61}
      Percentiles      Smallest
 1%    {res} .0029155              0
{txt} 5%    {res} .0155602       .0029155
{txt}10%    {res} .0410367       .0062112       {txt}Obs         {res}        123
{txt}25%    {res} .1882022       .0116279       {txt}Sum of Wgt. {res}        123

{txt}50%    {res} .3703704                      {txt}Mean          {res} .3667681
                        {txt}Largest       Std. Dev.     {res} .2317511
{txt}75%    {res} .5423281       .7985075
{txt}90%    {res}  .663063       .8176638       {txt}Variance      {res} .0537086
{txt}95%    {res} .7569331       .8346614       {txt}Skewness      {res}  .101194
{txt}99%    {res} .8346614       .8901099       {txt}Kurtosis      {res} 2.068836
{txt}
{com}. replace votesharec=r(mean) if _n==3
{txt}(1 real change made)

{com}. replace upperc=r(p95) if _n==3
{txt}(1 real change made)

{com}. replace lowerc=r(p5) if _n==3
{txt}(1 real change made)

{com}. replace sdc=r(sd) if _n==3
{txt}(1 real change made)

{com}. replace nc=r(N) if _n==3
{txt}(1 real change made)

{com}. 
. summ survey_vote if survey_vote~=., detail

                    {txt}Voteshare Survey Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res} .0526316              0
{txt}10%    {res} .1052632              0       {txt}Obs         {res}        237
{txt}25%    {res}       .3              0       {txt}Sum of Wgt. {res}        237

{txt}50%    {res} .4615385                      {txt}Mean          {res} .4988945
                        {txt}Largest       Std. Dev.     {res}  .279793
{txt}75%    {res}       .7              1
{txt}90%    {res} .9166667              1       {txt}Variance      {res} .0782841
{txt}95%    {res}        1              1       {txt}Skewness      {res} .1021618
{txt}99%    {res}        1              1       {txt}Kurtosis      {res} 2.101168
{txt}
{com}. replace voteshare=r(mean) if _n==2
{txt}(1 real change made)

{com}. replace upper=r(p95) if _n==2
{txt}(1 real change made)

{com}. replace lower=r(p5) if _n==2
{txt}(1 real change made)

{com}. replace sd=r(sd) if _n==2
{txt}(1 real change made)

{com}. replace n=r(N) if _n==2
{txt}(1 real change made)

{com}. 
. summ survey_vote if survey_vote~=. & urban==1, detail

                    {txt}Voteshare Survey Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res}       .1       .0714286
{txt}10%    {res} .1666667       .0833333       {txt}Obs         {res}         72
{txt}25%    {res} .2863636             .1       {txt}Sum of Wgt. {res}         72

{txt}50%    {res}  .458042                      {txt}Mean          {res} .4979999
                        {txt}Largest       Std. Dev.     {res} .2666596
{txt}75%    {res} .6666667          .9375
{txt}90%    {res}       .9              1       {txt}Variance      {res} .0711073
{txt}95%    {res}    .9375              1       {txt}Skewness      {res} .2230403
{txt}99%    {res}        1              1       {txt}Kurtosis      {res} 2.031488
{txt}
{com}. replace voteshareu=r(mean) if _n==2
{txt}(1 real change made)

{com}. replace upperu=r(p95) if _n==2
{txt}(1 real change made)

{com}. replace loweru=r(p5) if _n==2
{txt}(1 real change made)

{com}. replace sdu=r(sd) if _n==2
{txt}(1 real change made)

{com}. replace nu=r(N) if _n==2
{txt}(1 real change made)

{com}. 
. summ survey_vote if survey_vote~=. & urban==0, detail

                    {txt}Voteshare Survey Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res}        0              0
{txt}10%    {res} .0833333              0       {txt}Obs         {res}        163
{txt}25%    {res}       .3              0       {txt}Sum of Wgt. {res}        163

{txt}50%    {res} .4666667                      {txt}Mean          {res} .4968222
                        {txt}Largest       Std. Dev.     {res} .2850686
{txt}75%    {res} .7142857              1
{txt}90%    {res} .8823529              1       {txt}Variance      {res} .0812641
{txt}95%    {res}        1              1       {txt}Skewness      {res} .0532791
{txt}99%    {res}        1              1       {txt}Kurtosis      {res} 2.112507
{txt}
{com}. replace voteshareu=r(mean) if _n==4
{txt}(1 real change made)

{com}. replace upperu=r(p95) if _n==4
{txt}(1 real change made)

{com}. replace loweru=r(p5) if _n==4
{txt}(1 real change made)

{com}. replace sdu=r(sd) if _n==4
{txt}(1 real change made)

{com}. replace nu=r(N) if _n==4
{txt}(1 real change made)

{com}. 
. summ survey_vote if survey_vote~=. & competitive_margin==1, detail

                    {txt}Voteshare Survey Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res} .0555556              0
{txt}10%    {res}     .125              0       {txt}Obs         {res}        111
{txt}25%    {res} .3076923              0       {txt}Sum of Wgt. {res}        111

{txt}50%    {res}       .5                      {txt}Mean          {res} .5133578
                        {txt}Largest       Std. Dev.     {res} .2788609
{txt}75%    {res}      .75              1
{txt}90%    {res}     .875              1       {txt}Variance      {res} .0777634
{txt}95%    {res}        1              1       {txt}Skewness      {res}-.0216225
{txt}99%    {res}        1              1       {txt}Kurtosis      {res} 2.021941
{txt}
{com}. replace votesharec=r(mean) if _n==2
{txt}(1 real change made)

{com}. replace upperc=r(p95) if _n==2
{txt}(1 real change made)

{com}. replace lowerc=r(p5) if _n==2
{txt}(1 real change made)

{com}. replace sdc=r(sd) if _n==2
{txt}(1 real change made)

{com}. replace nc=r(N) if _n==2
{txt}(1 real change made)

{com}. 
. summ survey_vote if survey_vote~=. & competitive_margin==0, detail

                    {txt}Voteshare Survey Data
{hline 61}
      Percentiles      Smallest
 1%    {res}        0              0
{txt} 5%    {res} .0416667              0
{txt}10%    {res}       .1              0       {txt}Obs         {res}        123
{txt}25%    {res} .2857143              0       {txt}Sum of Wgt. {res}        123

{txt}50%    {res} .4615385                      {txt}Mean          {res} .4892932
                        {txt}Largest       Std. Dev.     {res} .2818484
{txt}75%    {res} .6666667              1
{txt}90%    {res} .9166667              1       {txt}Variance      {res} .0794385
{txt}95%    {res}        1              1       {txt}Skewness      {res} .2051736
{txt}99%    {res}        1              1       {txt}Kurtosis      {res} 2.188895
{txt}
{com}. replace votesharec=r(mean) if _n==4
{txt}(1 real change made)

{com}. replace upperc=r(p95) if _n==4
{txt}(1 real change made)

{com}. replace lowerc=r(p5) if _n==4
{txt}(1 real change made)

{com}. replace sdc=r(sd) if _n==4
{txt}(1 real change made)

{com}. replace nc=r(N) if _n==4
{txt}(1 real change made)

{com}. 
. generate hi=voteshare + invttail(n-1,0.025)*(sd / sqrt(n))
{txt}(1,320 missing values generated)

{com}. generate low=voteshare - invttail(n-1,0.025)*(sd / sqrt(n))
{txt}(1,320 missing values generated)

{com}. 
. generate hiu=voteshareu + invttail(nu-1,0.025)*(sdu / sqrt(nu))
{txt}(1,318 missing values generated)

{com}. generate lowu=voteshareu - invttail(nu-1,0.025)*(sdu / sqrt(nu))
{txt}(1,318 missing values generated)

{com}. 
. generate hic=votesharec + invttail(nc-1,0.025)*(sdc / sqrt(nc))
{txt}(1,318 missing values generated)

{com}. generate lowc=votesharec - invttail(nc-1,0.025)*(sdc / sqrt(nc))
{txt}(1,318 missing values generated)

{com}. 
. ***Figure 1
. graph twoway (bar voteshare data, barwidth(.6)) (rcap hi low data), ///
> xlabel(1 "Official" 2 "Survey", noticks) xscale(r(0.5 2.5)) /// 
> scheme(s1mono)  ytitle("Mean Incumbent Voteshare") yscale(r(0 .6)) ylabel(0(.1).5) ///
> xtitle("") legend(order(2 "95% Confidence Interval"))
{res}{txt}
{com}. 
. cap             graph export Drafts/JEPS/figures/voteshare_bar.pdf, as(pdf) replace
{txt}
{com}.                 
. ****Figure 3
. graph twoway (bar voteshareu data, barwidth(.6)) (rcap hiu lowu data), by(Urban) ///
> xlabel(1 "Official" 2 "Survey", noticks) xscale(r(0.5 2.5)) /// 
> scheme(s1mono)  ytitle("Mean Incumbent Voteshare") yscale(r(0 .6)) ylabel(0(.1).5) ///
> xtitle("") legend(order(2 "95% Confidence Interval"))
{res}{txt}
{com}. 
. cap             graph export Drafts/JEPS/figures/voteshare_bar_urban.pdf, as(pdf) replace
{txt}
{com}. 
. ****Figure 4
. graph twoway (bar votesharec data, barwidth(.6)) (rcap hic lowc data), by(Competitive) ///
> xlabel(1 "Official" 2 "Survey", noticks) xscale(r(0.5 2.5)) /// 
> scheme(s1mono)  ytitle("Mean Incumbent Voteshare") yscale(r(0 .6)) ylabel(0(.1).5) ///
> xtitle("") legend(order(2 "95% Confidence Interval"))
{res}{txt}
{com}. 
. cap             graph export Drafts/JEPS/figures/voteshare_bar_competitive.pdf, as(pdf) replace
{txt}
{com}. 
. gen turnout1=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen sd1=. in 1/2
{txt}(1,322 missing values generated)

{com}. gen n1=. in 1/2
{txt}(1,322 missing values generated)

{com}. 
. summ official_t if survey_turn~=., detail

                    {txt}Turnout Official Data
{hline 61}
      Percentiles      Smallest
 1%    {res} .3624031       .3181818
{txt} 5%    {res} .5153846       .3571429
{txt}10%    {res} .5616438       .3624031       {txt}Obs         {res}        234
{txt}25%    {res} .6303448       .4058942       {txt}Sum of Wgt. {res}        234

{txt}50%    {res} .7024327                      {txt}Mean          {res} .6962491
                        {txt}Largest       Std. Dev.     {res} .1073379
{txt}75%    {res} .7746193       .9038461
{txt}90%    {res} .8268685        .920765       {txt}Variance      {res} .0115214
{txt}95%    {res}  .853211       .9550073       {txt}Skewness      {res}-.4185202
{txt}99%    {res}  .920765       .9551724       {txt}Kurtosis      {res} 3.623324
{txt}
{com}. replace turnout1=r(mean) if _n==1
{txt}(1 real change made)

{com}. replace sd1=r(sd) if _n==1
{txt}(1 real change made)

{com}. replace n1=r(N) if _n==1
{txt}(1 real change made)

{com}. 
. summ survey_turn if survey_turn~=., detail

                     {txt}Turnout Survey Data
{hline 61}
      Percentiles      Smallest
 1%    {res} .4782609       .2941177
{txt} 5%    {res} .6666667             .4
{txt}10%    {res} .7619048       .4782609       {txt}Obs         {res}        237
{txt}25%    {res} .8571429             .5       {txt}Sum of Wgt. {res}        237

{txt}50%    {res} .9230769                      {txt}Mean          {res} .9011378
                        {txt}Largest       Std. Dev.     {res} .1160318
{txt}75%    {res}        1              1
{txt}90%    {res}        1              1       {txt}Variance      {res} .0134634
{txt}95%    {res}        1              1       {txt}Skewness      {res} -1.81163
{txt}99%    {res}        1              1       {txt}Kurtosis      {res} 7.685912
{txt}
{com}. replace turnout1=r(mean) if _n==2
{txt}(1 real change made)

{com}. replace sd1=r(sd) if _n==2
{txt}(1 real change made)

{com}. replace n1=r(N) if _n==2
{txt}(1 real change made)

{com}. 
. generate hi1=turnout1 + invttail(n1-1,0.025)*(sd1 / sqrt(n1))
{txt}(1,320 missing values generated)

{com}. generate low1=turnout1 - invttail(n1-1,0.025)*(sd1 / sqrt(n1))
{txt}(1,320 missing values generated)

{com}. 
. ****Figure 2
. graph twoway (bar turnout1 data, barwidth(.6)) (rcap hi1 low1 data), ///
> xlabel(1 "Official" 2 "Survey", noticks) xscale(r(0.5 2.5)) /// 
> scheme(s1mono)  ytitle("Mean Voter Turnout") ylabel(0(.1).9) ///
> xtitle("") legend(order(2 "95% Confidence Interval"))
{res}{txt}
{com}. 
. cap             graph export Drafts/JEPS/figures/turnout_bar.pdf, as(pdf) replace       
{txt}
{com}. 
. ************************
. 
. ***Figures 5 and 6
. ** Plots with confidence intervals from regressions
. 
. 
. label variable treatment "Treatment Effect"
{txt}
{com}. 
. areg official_vote treatment if survey_vote~=.&goodnews==1, absorb(blid)                
{res}
{txt}Linear regression, absorbing indicators{col 49}Number of obs{col 67}= {res}       135
{txt}{col 49}F({res}   1{txt},{res}    101{txt}){col 67}= {res}      0.29
{txt}{col 49}Prob > F{col 67}= {res}    0.5883
{txt}{col 49}R-squared{col 67}= {res}    0.6689
{txt}{col 49}Adj R-squared{col 67}= {res}    0.5607
{txt}{col 49}Root MSE{col 67}= {res}    0.1412

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}official_v~e{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2}-.0162258{col 26}{space 2} .0298775{col 37}{space 1}   -0.54{col 46}{space 3}0.588{col 54}{space 4}-.0754948{col 67}{space 3} .0430432
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .3226566{col 26}{space 2} .0260299{col 37}{space 1}   12.40{col 46}{space 3}0.000{col 54}{space 4} .2710202{col 67}{space 3}  .374293
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
        blid {c |}        F(32, 101) = {res}     6.376   0.000          {txt}(33 categories)

{com}.                 est store Official
{txt}
{com}. 
. preserve
{txt}
{com}. 
.         use "survey_merge.dta", clear
{txt}
{com}. 
.         * Run do file
.         do 01_survey_clean.do
{txt}
{com}. 
. set more off
{txt}
{com}. 
. /*
> NOTE ON SURVEY DATA: About 6000 people were surveyed at baseline.  
> Another 6000 were treated (publicly or privately), but were not surveyed
> About 3000 are in the sample at endline
> */
. 
. 
. **** Treatment variables ********
.         
. tab condition, missing

       {txt}condition {c |}      Freq.     Percent        Cum.
{hline 17}{c +}{hline 35}
Control + Survey {c |}{res}      1,217        9.72        9.72
{txt}            T1T3 {c |}{res}      2,343       18.71       28.42
{txt}            T1T4 {c |}{res}      2,809       22.43       50.85
{txt}            T2T3 {c |}{res}      2,360       18.84       69.69
{txt}            T2T4 {c |}{res}      3,797       30.31      100.00
{txt}{hline 17}{c +}{hline 35}
           Total {c |}{res}     12,526      100.00
{txt}
{com}. 
.         gen control=0 if condition=="T1T4"|condition=="T1T3"|condition=="T2T3"|condition=="T2T4"
{txt}(1,217 missing values generated)

{com}.         replace control=1 if condition=="Control + Survey"
{txt}(1,217 real changes made)

{com}.         tab control ,missing

    {txt}control {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}     11,309       90.28       90.28
{txt}          1 {c |}{res}      1,217        9.72      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}.         
. * create treatment indicator
. gen treatment=0
{txt}
{com}. replace treatment=1 if control!=1
{txt}(11,309 real changes made)

{com}. tab treatment, missing

  {txt}treatment {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,217        9.72        9.72
{txt}          1 {c |}{res}     11,309       90.28      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. ** indicators for treatment conditions
. encode condition, gen(condition_numeric) // private is 2 and 4, public is 3 and 5, control is 1
{txt}
{com}. tab condition_numeric, missing  

{txt}condition_numeri {c |}
               c {c |}      Freq.     Percent        Cum.
{hline 17}{c +}{hline 35}
Control + Survey {c |}{res}      1,217        9.72        9.72
{txt}            T1T3 {c |}{res}      2,343       18.71       28.42
{txt}            T1T4 {c |}{res}      2,809       22.43       50.85
{txt}            T2T3 {c |}{res}      2,360       18.84       69.69
{txt}            T2T4 {c |}{res}      3,797       30.31      100.00
{txt}{hline 17}{c +}{hline 35}
           Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. * some people were treated but not surveyed
. generate nosurvey=0
{txt}
{com}. replace nosurvey=1 if typet3==3 | typet4==2
{txt}(6,174 real changes made)

{com}. 
. gen infoonly=.
{txt}(12,526 missing values generated)

{com}. replace infoonly=1 if condition=="T1T3" | condition=="T1T4"
{txt}(5,152 real changes made)

{com}. replace infoonly=0 if condition=="T2T3" | condition=="T2T4" | control==1
{txt}(7,374 real changes made)

{com}. tab infoonly, missing

   {txt}infoonly {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      7,374       58.87       58.87
{txt}          1 {c |}{res}      5,152       41.13      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. gen civics=.
{txt}(12,526 missing values generated)

{com}. replace civics=1 if condition=="T2T3" | condition=="T2T4"
{txt}(6,157 real changes made)

{com}. replace civics=0 if condition=="T1T3" | condition=="T1T4" | control==1
{txt}(6,369 real changes made)

{com}. tab civics, missing

     {txt}civics {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      6,369       50.85       50.85
{txt}          1 {c |}{res}      6,157       49.15      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. **** Indicator for block
. replace block = 4 if dosage==0 // villages in low dose all in same block
{txt}(1,243 real changes made)

{com}. 
. egen blid = group(commune block)  // generate block that combines block/commune
{txt}
{com}. 
. 
. ****** DV: vote for incumbent at endline
. * also do self reported turnout (for appendix)
. 
. tab endlineeq6

   {txt}A présent, nous {c |}
      aimerions en {c |}
savoir plus sur le {c |}
 parti pour lequel {c |}
     vous avez vot {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
               Non {c |}{res}      1,512       49.59       49.59
{txt}               Oui {c |}{res}      1,524       49.98       99.57
{txt}       Ne sait pas {c |}{res}          8        0.26       99.84
{txt}Refuse de répondre {c |}{res}          5        0.16      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      3,049      100.00
{txt}
{com}. recode endlineeq6 (98 99 = .), gen(incumbent_vote)
{txt}(13 differences between endlineeq6 and incumbent_vote)

{com}. 
. recode endlineeq3 (98 99 3= .), gen(turnout)
{txt}(1 differences between endlineeq3 and turnout)

{com}. 
. ************************************************************
. **** Main IV: Coethnic with incumbent
. tab surveycb24, missing

 {txt}En pensant {c |}
          à {c |}
  ${c -(}dname{c )-}, {c |}
diriez-vous {c |}
   que vous {c |}
partagez le {c |}
       même {c |}
     groupe {c |}
 ethnique a {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        Non {c |}{res}      2,317       18.50       18.50
{txt}        Oui {c |}{res}      3,755       29.98       48.48
{txt}          . {c |}{res}      6,454       51.52      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. tab surveycb24 if incumbent_vote~=., missing

 {txt}En pensant {c |}
          à {c |}
  ${c -(}dname{c )-}, {c |}
diriez-vous {c |}
   que vous {c |}
partagez le {c |}
       même {c |}
     groupe {c |}
 ethnique a {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        Non {c |}{res}      1,041       34.29       34.29
{txt}        Oui {c |}{res}      1,978       65.15       99.44
{txt}          . {c |}{res}         17        0.56      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      3,036      100.00
{txt}
{com}. 
. gen coethnic= surveycb24
{txt}(6,454 missing values generated)

{com}.         label variable coethnic "Coethnic with incumbent"
{txt}
{com}. 
.         
. ***********************************************
. ** Define "good" information, relative to priors
.         ** If don't know, we code based on whether legislator was better or worse than local
.         ** If priors = information, we code based on whether prior was negative or positive
.                 * rational is information would strengthen belief in prior if the same
. 
. recode surveycb29 (99=.) (4=1) (3=2) (2=3) (1=4), gen (performanceplenary) 
{txt}(6106 differences between surveycb29 and performanceplenary)

{com}. recode surveycb31 (99=.) (4=1) (3=2) (2=3) (1=4), gen (performancecommittee) 
{txt}(6104 differences between surveycb31 and performancecommittee)

{com}. recode surveycb33 (99=.) (4=1) (3=2) (2=3) (1=4), gen (performanceboth) 
{txt}(6105 differences between surveycb33 and performanceboth)

{com}.                 
. tab performanceboth, missing // this is the prior on overall performance, ranging from 1 (worst prior) to 4 (best prior)

  {txt}RECODE of {c |}
 surveycb33 {c |}
 (Nous vous {c |}
  avons dît {c |}
    que les {c |}
    députés {c |}
participent {c |}
 aux séance {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          1 {c |}{res}        587        4.69        4.69
{txt}          2 {c |}{res}        788        6.29       10.98
{txt}          3 {c |}{res}        913        7.29       18.27
{txt}          4 {c |}{res}        463        3.70       21.96
{txt}          . {c |}{res}      9,775       78.04      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. rename overall_departememt overall_departement
{res}{txt}
{com}. tab overall_departement, missing // this is the info we provided, ranging from 1 (best perf) to 4 (worst perf)

{txt}overall_dep {c |}
   artement {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          1 {c |}{res}      2,532       20.21       20.21
{txt}          2 {c |}{res}      4,849       38.71       58.93
{txt}          3 {c |}{res}      2,494       19.91       78.84
{txt}          4 {c |}{res}      2,571       20.53       99.36
{txt}          . {c |}{res}         80        0.64      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. recode overall_departement (99=.) (4=1) (3=2) (2=3) (1=4), gen (overall_dept_recode)
{txt}(12446 differences between overall_departement and overall_dept_recode)

{com}. gen goodnewsrelative2=1 if (performanceboth==1 & overall_dept_recode>1) | (performanceboth==2 & overall_dept_recode>2) | (performanceboth==3 & overall_dept_recode>2) | (performanceboth==4 & overall_dept_recode==4)
{txt}(10,944 missing values generated)

{com}. replace goodnewsrelative2=0 if (performanceboth==1 & overall_dept_recode==1) | (performanceboth==2 & overall_dept_recode<3) | (performanceboth==3 & overall_dept_recode<3) | (performanceboth==4 & overall_dept_recode<4)
{txt}(1,166 real changes made)

{com}. replace goodnewsrelative2=1 if (performanceboth==. & overall_dept_recode==3) | (performanceboth==. & overall_dept_recode==4)
{txt}(5,788 real changes made)

{com}. replace goodnewsrelative2=0 if (performanceboth==. & overall_dept_recode==2) | (performanceboth==. & overall_dept_recode==1)
{txt}(3,937 real changes made)

{com}. tab goodnewsrelative2, missing

{txt}goodnewsrel {c |}
     ative2 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      5,103       40.74       40.74
{txt}          1 {c |}{res}      7,370       58.84       99.58
{txt}          . {c |}{res}         53        0.42      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. summarize goodnewsrelative2

{txt}    Variable {c |}        Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 57}
goodnewsre~2 {c |}{res}     12,473    .5908763    .4916919          0          1
{txt}
{com}. 
. ** Also create good news measure that corresponds with Admin
.         * not conditional on priors
. 
. gen goodnews = 0 if overall_dept_recode==1 | overall_dept_recode==2
{txt}(7,461 missing values generated)

{com}.         replace goodnews = 1 if overall_dept_recode==3 | overall_dept_recode==4
{txt}(7,381 real changes made)

{com}. 
. 
. ********************************************
. ** Create dummy indicators for each Prior category (to use as control)
. capture tab surveycb33, gen(p)   // overall prior -- will include control that also has indicator for don't knows
{txt}
{com}. label variable p1 "Prior --- Much better"
{txt}
{com}. label variable p2 "Prior --- A little better"
{txt}
{com}. label variable p3 "Prior --- A little worse"
{txt}
{com}. label variable p4 "Prior --- Much worse"
{txt}
{com}. label variable p5 "Prior --- Do not know"
{txt}
{com}. 
. ****************************************************
. ** ***** Measure of of prior vote for incumbent (partisanship) 
. 
. ** Merge in information about the incumbent's political party
. tempfile temp2
{txt}
{com}. save `temp2', replace
{txt}(note: file C:\Users\JGOTTL~1\AppData\Local\Temp\ST_01000002.tmp not found)
file C:\Users\JGOTTL~1\AppData\Local\Temp\ST_01000002.tmp saved

{com}. 
. insheet using "communes.csv", names clear
{txt}(7 vars, 30 obs)

{com}. rename commune_key commune
{res}{txt}
{com}. rename party incumbent_party2011
{res}{txt}
{com}. 
. sort commune
{txt}
{com}. 
. merge 1:m commune  using `temp2'
{res}{txt}{p 0 7 2}
(note: variable
symbol was 
str25, now str27 to accommodate using data's values)
{p_end}
(label condition_numeric already defined)
(label vid already defined)
(label cid already defined)
(label iid already defined)
(label language_video already defined)
(label deputy_present already defined)
(label community_center already defined)
(label clinic already defined)
(label borehole already defined)
(label mosque_church already defined)
(label school already defined)
(label consent already defined)
(label endlineeq3 already defined)
(label endlineeq4a already defined)
(label endlineeq4b already defined)
(label endlineeq5a already defined)
(label endlineeq5b already defined)
(label endlineeq6 already defined)
(label endlineeq already defined)
(label endlineeq7 already defined)
(label endlineeq8 already defined)
(label endlineeq9_control already defined)
(label endlineeq9_cservice already defined)
(label endlineeq9_legislative already defined)
(label endlineeq10_private already defined)
(label endlineeq10_public_control already defined)
(label endlineeq12 already defined)
(label endlineeq13 already defined)
(label endlineeq14 already defined)
(label endlineeq15 already defined)
(label endlineeq16 already defined)
(label endlineeq17 already defined)
(label endlineeq18 already defined)
(label endlineeq19 already defined)
(label endlineeq20 already defined)
(label endlineeq21 already defined)
(label endlineeq22 already defined)
(label endlineeq23 already defined)
(label endlineeq24 already defined)
(label endlineeq25 already defined)
(label endlineeq26 already defined)
(label endlineeq27 already defined)
(label endlineeq29 already defined)
(label endlineeq30 already defined)
(label endlineeq31 already defined)
(label endlineeq32 already defined)
(label endlineeq34 already defined)
(label endlineeq36 already defined)
(label refusetryagain already defined)
(label _merge already defined)
(label b4 already defined)
(label b45 already defined)
(label b47 already defined)
(label b48 already defined)
(label b49 already defined)
(label b50 already defined)
(label surveycb61 already defined)
(label surveycb60 already defined)
(label surveycb57 already defined)
(label surveycb54 already defined)
(label surveycb44 already defined)
(label surveycb43 already defined)
(label surveycb42 already defined)
(label surveycb41 already defined)
(label surveycb40f already defined)
(label surveycb40e already defined)
(label surveycb40d already defined)
(label surveycb40c already defined)
(label surveycb40b already defined)
(label surveycb40a already defined)
(label surveycb39e already defined)
(label surveycb39c already defined)
(label surveycb39b already defined)
(label surveycb39a already defined)
(label surveycb38 already defined)
(label surveycb38a already defined)
(label surveycb37_legislative already defined)
(label surveycb37_cservice already defined)
(label surveycb37_control already defined)
(label surveycb36 already defined)
(label surveycb35 already defined)
(label surveycb34 already defined)
(label surveycb33 already defined)
(label surveycb32 already defined)
(label surveycb31 already defined)
(label surveycb30 already defined)
(label surveycb29 already defined)
(label surveycb28 already defined)
(label surveycb27 already defined)
(label surveycb26 already defined)
(label surveycb25 already defined)
(label surveycb24 already defined)
(label surveycb23 already defined)
(label surveycb22 already defined)
(label surveycb21 already defined)
(label surveycb20_legislative already defined)
(label surveycb20_cservice already defined)
(label surveycb20_control already defined)
(label surveycb18 already defined)
(label surveycb17 already defined)
(label surveycb14 already defined)
(label surveycb13 already defined)
(label surveycb12e already defined)
(label surveycb12d already defined)
(label surveycb12c already defined)
(label surveycb12b already defined)
(label surveycb12a already defined)
(label surveycb10b already defined)
(label surveycb10 already defined)
(label surveycb8 already defined)
(label surveycb7b already defined)
(label surveycb7 already defined)
(label surveycb4 already defined)
(label surveypconsentb3c already defined)
(label surveypconsentconsent already defined)
(label typet4 already defined)
(label typet3 already defined)
(label enumber already defined)
(label en9 already defined)
(label en4 already defined)
(label en3 already defined)

{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}          12,526{txt}  (_merge==3)
{col 5}{hline 41}

{com}. 
. tab incumbent_party2011

{txt}incumbent_p {c |}
   arty2011 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        AFU {c |}{res}        736        5.88        5.88
{txt}       FCBE {c |}{res}      5,960       47.58       53.46
{txt}     FE UPR {c |}{res}        836        6.67       60.13
{txt}        G13 {c |}{res}      1,476       11.78       71.91
{txt}         UN {c |}{res}      3,518       28.09      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. tab surveycb19

    {txt}Pour quel {c |}
        parti {c |}
    avez-vous {c |}
        voté? {c |}      Freq.     Percent        Cum.
{hline 14}{c +}{hline 35}
            9 {c |}{res}        148        3.07        3.07
{txt}           99 {c |}{res}        540       11.20       14.27
{txt}          AFU {c |}{res}          3        0.06       14.33
{txt}AmanaAlliance {c |}{res}         19        0.39       14.72
{txt}       Cauris {c |}{res}         55        1.14       15.86
{txt}         FCBE {c |}{res}      3,037       62.98       78.85
{txt}          G13 {c |}{res}        360        7.47       86.31
{txt}           UB {c |}{res}          5        0.10       86.42
{txt}           UN {c |}{res}        595       12.34       98.76
{txt}          UPR {c |}{res}         60        1.24      100.00
{txt}{hline 14}{c +}{hline 35}
        Total {c |}{res}      4,822      100.00
{txt}
{com}. 
. generate votedincumbent2011=0 if surveycb18==1
{txt}(7,687 missing values generated)

{com}. replace votedincumbent2011=1 if surveycb19=="FCBE" & incumbent_party=="FCBE"
{txt}(1,752 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="Cauris" & incumbent_party=="FCBE"
{txt}(44 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="UN" & incumbent_party=="UN"
{txt}(487 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="G13" & incumbent_party=="G13"
{txt}(240 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="AFU" & incumbent_party=="AFU"
{txt}(0 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="UPR" & incumbent_party=="FE UPR"
{txt}(13 real changes made)

{com}. 
. label var votedincumbent2011 "2011 Incumbent Vote"
{txt}
{com}. 
.         
. *****************************************
. ** Other individual level vars for balance, etc
. 
. recode surveycb4 (2=1) (1=0), gen(female)
{txt}(6128 differences between surveycb4 and female)

{com}. 
. gen age=surveycb5 if surveycb5>18 & surveycb5<100
{txt}(6,547 missing values generated)

{com}. 
. encode surveycb9, gen(ethnicity_numeric)
{txt}
{com}. 
. encode surveycb6, gen(language)
{txt}
{com}. 
. gen educyears=surveycb7
{txt}(6,469 missing values generated)

{com}. 
. 
. gen conseil_chef = surveycb12a
{txt}(6,410 missing values generated)

{com}.         label variable conseil_chef "Member of chief's council"
{txt}
{com}. gen professional =  surveycb12b
{txt}(6,419 missing values generated)

{com}.         label variable professional "Member of professional assoc."
{txt}
{com}. gen jeunes= surveycb12c
{txt}(6,439 missing values generated)

{com}.         label variable jeunes "Member of youth assoc."
{txt}
{com}. gen womens_group= surveycb12d
{txt}(6,440 missing values generated)

{com}.         label variable womens_gr "Member of women's assoc."
{txt}
{com}. gen politique= surveycb12e
{txt}(6,425 missing values generated)

{com}.         label variable politique "Member of political assoc."
{txt}
{com}.         
. tab surveycb13, gen(information_source)

        {txt}Quelle source {c |}
       d’informations {c |}
utilisez-vous le plus {c |}
     fréquemment pour {c |}
            rester au {c |}      Freq.     Percent        Cum.
{hline 22}{c +}{hline 35}
                Radio {c |}{res}      3,908       63.86       63.86
{txt}             Journaux {c |}{res}         32        0.52       64.38
{txt}           Télévision {c |}{res}        556        9.08       73.46
{txt}Amis ou connaissances {c |}{res}      1,128       18.43       91.90
{txt}               Autre: {c |}{res}         49        0.80       92.70
{txt}               Aucune {c |}{res}        447        7.30      100.00
{txt}{hline 22}{c +}{hline 35}
                Total {c |}{res}      6,120      100.00
{txt}
{com}.         label variable information_source1 "Information from radio"
{txt}
{com}.         label variable information_source2 "Information from newspaper"
{txt}
{com}.         label variable information_source3 "Information from television"
{txt}
{com}.         label variable information_source4 "Information from friends"
{txt}
{com}. 
. tab surveycb14, gen(discuss)

 {txt}Quand vous {c |}
 êtes entre {c |}
 amis ou en {c |}
   famille, {c |}
 combien de {c |}
fois parlez {c |}
    vous de {c |}
     choses {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     Jamais {c |}{res}      2,342       38.27       38.27
{txt}    Parfois {c |}{res}      3,014       49.25       87.52
{txt}    Souvent {c |}{res}        764       12.48      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      6,120      100.00
{txt}
{com}.         label variable discuss1 "Never discuss politics"
{txt}
{com}.         label variable discuss2 "Sometimes discuss poltics"
{txt}
{com}.         label variable discuss3 "Often discuss politics"
{txt}
{com}. 
. recode surveycb21 (3 4 = 1) (1 2 = 0), gen(secret_ballot)
{txt}(5962 differences between surveycb21 and secret_ballot)

{com}.          tab secret surveycb21

 {txt}RECODE of {c |}
surveycb21 {c |}
   (Est-il {c |}
  probable {c |}
   que les {c |}
 hommes et {c |}
 femmes de {c |} Est-il probable que les hommes et femmes de
   pouvoir {c |}    pouvoir puissent savoir comment vous
    puisse {c |} Pas du to  Pas vraim  Assez pro  Très prob {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}     2,978      1,834          0          0 {txt}{c |}{res}     4,812 
{txt}         1 {c |}{res}         0          0        682        468 {txt}{c |}{res}     1,150 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}     2,978      1,834        682        468 {txt}{c |}{res}     5,962 

{txt}
{com}.          label variable secret "Ballot secrecy can be violated"
{txt}
{com}. 
. gen know_village_vote= surveycb42
{txt}(6,475 missing values generated)

{com}.         label variable know_village_ "Parties know how the village voted"
{txt}
{com}. 
. gen consequences =surveycb43
{txt}(9,065 missing values generated)

{com}.         label variable consequences "Consequences if village does not support a party"
{txt}
{com}. 
. gen help= surveycb27
{txt}(6,435 missing values generated)

{com}.         label variable help "Received Help"
{txt}
{com}. 
. recode  surveycb33 (1 2 = 1) (3 4 =0) (99 = .), gen(overall_prior)
{txt}(5642 differences between surveycb33 and overall_prior)

{com}.         label variable overall_prio "Positive Overall Prior"
{txt}
{com}. 
. recode  surveycb35 (1 2 = 1) (3 4 =0) (99 = .), gen(effort_prior)
{txt}(5757 differences between surveycb35 and effort_prior)

{com}.         label variable effort_prio "Positive prior about effort of incumbent"
{txt}
{com}.         
. recode  surveycb36 (1 2 = 1) (3 4 =0) (99 = .), gen(corruption_prior)
{txt}(4122 differences between surveycb36 and corruption_prior)

{com}.         label variable corruption_prio "Would be surprised to hear about incumbent corruption"
{txt}
{com}. 
. 
. 
. label variable urban "Urban"
{txt}
{com}. label variable margin "Vote margin (top 2 parties) in previous election"
{txt}
{com}. 
. 
. label variable assembly_index  "Incumbent score on plenary index"
{txt}
{com}. label variable committee_index  "Incumbent score on committee index"
{txt}
{com}. label variable main_index "Incumbent score overall index"
{txt}
{com}. label variable female "Female"
{txt}
{com}. 
. label variable educyears "Years of education"
{txt}
{com}. label variable age "Age"
{txt}
{com}. 
. label var treatment "Treatment"
{txt}
{com}. ******************
.         ************ Access to electricity ************
. 
. tab surveycb60, missing

   {txt}Quelle est la source {c |}
   principale d’énergie {c |}
dans cette concession ? {c |}      Freq.     Percent        Cum.
{hline 24}{c +}{hline 35}
Courant fourni par SBEE {c |}{res}      1,610       12.85       12.85
{txt}     Groupe électrogène {c |}{res}        309        2.47       15.32
{txt}         Lampe kérosène {c |}{res}      1,631       13.02       28.34
{txt}         Torches à pile {c |}{res}      1,971       15.74       44.08
{txt}                Bougies {c |}{res}         32        0.26       44.33
{txt}        Energie solaire {c |}{res}         60        0.48       44.81
{txt}                Autre : {c |}{res}        143        1.14       45.95
{txt}                 Aucune {c |}{res}        354        2.83       48.78
{txt}                      . {c |}{res}      6,416       51.22      100.00
{txt}{hline 24}{c +}{hline 35}
                  Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. gen electricity_type=surveycb60
{txt}(6,416 missing values generated)

{com}. replace electricity=1 if electricity_type==1 |electricity_type==2|electricity_type==6
{txt}(369 real changes made)

{com}. replace electricity=0 if electricity_type==3 | electricity_type==4 | electricity_type==5| electricity_type==7| electricity_type==8
{txt}(4,131 real changes made)

{com}. 
. tab electricity

{txt}electricity {c |}
      _type {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      4,131       67.61       67.61
{txt}          1 {c |}{res}      1,979       32.39      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      6,110      100.00
{txt}
{com}. 
. ************ Material of House ************
. 
. tab surveycb58, missing

    {txt}De quel matériel était faite la {c |}
   maison dans laquelle l’entretien {c |}
                          s’est con {c |}      Freq.     Percent        Cum.
{hline 36}{c +}{hline 35}
                                    {c |}{res}      6,417       51.23       51.23
{txt}                                 15 {c |}{res}          1        0.01       51.24
{txt}                    A coté d'un mur {c |}{res}          1        0.01       51.25
{txt}                  A côté  d'un  mur {c |}{res}         25        0.20       51.44
{txt}             A côté  d'un  paillote {c |}{res}          1        0.01       51.45
{txt}               A côté  d'un apattam {c |}{res}          2        0.02       51.47
{txt}                   A côté  d'un mur {c |}{res}          6        0.05       51.52
{txt}                   A côté d'un  mur {c |}{res}          2        0.02       51.53
{txt}                    A côté d'un mur {c |}{res}          2        0.02       51.55
{txt}                             Apatam {c |}{res}         10        0.08       51.63
{txt}                            Apattam {c |}{res}         17        0.14       51.76
{txt}                            Appatam {c |}{res}          1        0.01       51.77
{txt}                              Argil {c |}{res}          1        0.01       51.78
{txt}                             Argile {c |}{res}         18        0.14       51.92
{txt}                    Avec  du ciment {c |}{res}          1        0.01       51.93
{txt}                             Bambou {c |}{res}         64        0.51       52.44
{txt}                              Bamko {c |}{res}          1        0.01       52.45
{txt}                              Banci {c |}{res}          1        0.01       52.46
{txt}                              Banco {c |}{res}        479        3.82       56.28
{txt}                              Banka {c |}{res}          1        0.01       56.29
{txt}                              Banko {c |}{res}        210        1.68       57.97
{txt}                              Banvo {c |}{res}          1        0.01       57.98
{txt}                     Barre de terre {c |}{res}          1        0.01       57.98
{txt}                              Bique {c |}{res}          1        0.01       57.99
{txt}                               Bloc {c |}{res}          6        0.05       58.04
{txt}                              Block {c |}{res}         14        0.11       58.15
{txt}                             Bloque {c |}{res}         56        0.45       58.60
{txt}                               Bois {c |}{res}         17        0.14       58.73
{txt}                               Boue {c |}{res}          5        0.04       58.77
{txt}                             Brique {c |}{res}        360        2.87       61.65
{txt}                   Brique  de terre {c |}{res}          2        0.02       61.66
{txt}                  Brique  en  banco {c |}{res}          1        0.01       61.67
{txt}                   Brique  en banco {c |}{res}          2        0.02       61.69
{txt}                    Brique  en dure {c |}{res}          1        0.01       61.70
{txt}                       Brique banco {c |}{res}          1        0.01       61.70
{txt}                   Brique de ciment {c |}{res}          7        0.06       61.76
{txt}                    Brique de terre {c |}{res}        156        1.25       63.00
{txt}              Brique de terre battu {c |}{res}          1        0.01       63.01
{txt}             Brique de terre battue {c |}{res}          2        0.02       63.03
{txt}      Brique de terre, terre battue {c |}{res}          2        0.02       63.04
{txt}       Brique de terre,terre battue {c |}{res}          1        0.01       63.05
{txt}                   Brique en  banco {c |}{res}          2        0.02       63.07
{txt}                    Brique en banco {c |}{res}         18        0.14       63.21
{txt}Brique en banco et en terre  battue {c |}{res}          1        0.01       63.22
{txt}             Brique en terre battue {c |}{res}          1        0.01       63.23
{txt}                    Brique et terre {c |}{res}          1        0.01       63.24
{txt}             Brique et terre battue {c |}{res}          1        0.01       63.24
{txt}                Brique terre battue {c |}{res}          2        0.02       63.26
{txt}                            Briques {c |}{res}        546        4.36       67.62
{txt}        Briques  de terre en battue {c |}{res}          2        0.02       67.64
{txt}           Briques  en terre battue {c |}{res}          1        0.01       67.64
{txt}             Briques  et terre batu {c |}{res}          1        0.01       67.65
{txt}                Briques  stabilisée {c |}{res}          1        0.01       67.66
{txt}                  Briques de ciment {c |}{res}         20        0.16       67.82
{txt}           Briques de terre  battue {c |}{res}          1        0.01       67.83
{txt}  Briques de terre  battue + ciment {c |}{res}          1        0.01       67.83
{txt}             Briques de terre battu {c |}{res}          2        0.02       67.85
{txt}            Briques de terre battue {c |}{res}         39        0.31       68.16
{txt}   Briques de terre battue + ciment {c |}{res}         15        0.12       68.28
{txt}    Briques de terre battue +ciment {c |}{res}          2        0.02       68.30
{txt}  Briques dee terre battue + ciment {c |}{res}          1        0.01       68.31
{txt}                Briques des  ciment {c |}{res}          1        0.01       68.31
{txt}   Briques dr terre  battue +ciment {c |}{res}          1        0.01       68.32
{txt}                      Briques dures {c |}{res}          1        0.01       68.33
{txt}                  Briques en ciment {c |}{res}          1        0.01       68.34
{txt}           Briques en terre  battue {c |}{res}          1        0.01       68.35
{txt}            Briques en terre battue {c |}{res}          7        0.06       68.40
{txt}              Briques en terre batu {c |}{res}          1        0.01       68.41
{txt}           Briques et terre- battue {c |}{res}          1        0.01       68.42
{txt}                      Briques rouge {c |}{res}          2        0.02       68.43
{txt}               Briques terre battue {c |}{res}          1        0.01       68.44
{txt}      Briques terre battue + ciment {c |}{res}          2        0.02       68.46
{txt}       Briques terre battue +ciment {c |}{res}          1        0.01       68.47
{txt}                              Brque {c |}{res}          1        0.01       68.47
{txt}                              Bsnco {c |}{res}          3        0.02       68.50
{txt}                             Chaume {c |}{res}          2        0.02       68.51
{txt}                             Ciment {c |}{res}        158        1.26       69.77
{txt}                               Clai {c |}{res}          1        0.01       69.78
{txt}                       Dans la cour {c |}{res}          2        0.02       69.80
{txt}          Dans la cour de la maison {c |}{res}          2        0.02       69.81
{txt}          Dans la cour de sa maison {c |}{res}          1        0.01       69.82
{txt}                       Dans sa cour {c |}{res}          1        0.01       69.83
{txt}         Dans une clôture en brique {c |}{res}          1        0.01       69.84
{txt}                         Demi banko {c |}{res}          1        0.01       69.85
{txt}                        Demi-Bloque {c |}{res}          1        0.01       69.85
{txt}                                Dur {c |}{res}          8        0.06       69.92
{txt}                               Dure {c |}{res}         23        0.18       70.10
{txt}                          En bambou {c |}{res}          3        0.02       70.13
{txt}                           En banco {c |}{res}          7        0.06       70.18
{txt}                           En banko {c |}{res}          1        0.01       70.19
{txt}                   En briques dures {c |}{res}          1        0.01       70.20
{txt}                            En clai {c |}{res}          6        0.05       70.25
{txt}                           En clair {c |}{res}          3        0.02       70.27
{txt}                          En claire {c |}{res}          4        0.03       70.30
{txt}                             En dur {c |}{res}         11        0.09       70.39
{txt}                            En dure {c |}{res}         10        0.08       70.47
{txt}                     En terre battu {c |}{res}          1        0.01       70.48
{txt}                    En terre battue {c |}{res}          1        0.01       70.49
{txt}                              Endur {c |}{res}          1        0.01       70.49
{txt}                             Endure {c |}{res}          1        0.01       70.50
{txt}                   Feuille de palme {c |}{res}          1        0.01       70.51
{txt}                 Feuille de palmier {c |}{res}          1        0.01       70.52
{txt}                    Français -peulh {c |}{res}          1        0.01       70.53
{txt}                           Gbomitan {c |}{res}          2        0.02       70.54
{txt}                             Hangar {c |}{res}          2        0.02       70.56
{txt}               MATERIAUX Definitifs {c |}{res}          1        0.01       70.57
{txt}              Maison a terre battue {c |}{res}          1        0.01       70.57
{txt}                   Maison en brique {c |}{res}          4        0.03       70.61
{txt}               Matériaux  definitif {c |}{res}          2        0.02       70.62
{txt}              Matériaux  definitifs {c |}{res}          1        0.01       70.63
{txt}                Matériaux  defitifs {c |}{res}          1        0.01       70.64
{txt}               Matériaux  définitif {c |}{res}          6        0.05       70.68
{txt}              Matériaux  définitifs {c |}{res}          6        0.05       70.73
{txt}                  Matériaux  locaux {c |}{res}         16        0.13       70.86
{txt}                Matériaux  précaire {c |}{res}         93        0.74       71.60
{txt}               Matériaux  précaires {c |}{res}          4        0.03       71.63
{txt}               Matériaux definitifs {c |}{res}          2        0.02       71.65
{txt}                Matériaux définitif {c |}{res}          3        0.02       71.67
{txt}               Matériaux définitifs {c |}{res}         35        0.28       71.95
{txt}                   Matériaux locaux {c |}{res}         43        0.34       72.30
{txt}                 Matériaux primaire {c |}{res}          1        0.01       72.31
{txt}               Matériaux pré caires {c |}{res}          1        0.01       72.31
{txt}                 Matériaux précaire {c |}{res}         20        0.16       72.47
{txt}                Matériaux précaires {c |}{res}        109        0.87       73.34
{txt}   Mélange de ciment et terre battu {c |}{res}          1        0.01       73.35
{txt}                              Pagne {c |}{res}          1        0.01       73.36
{txt}                         Paillasson {c |}{res}          2        0.02       73.38
{txt}                             Paille {c |}{res}         10        0.08       73.46
{txt}                            Pailles {c |}{res}          1        0.01       73.46
{txt}                          Plein air {c |}{res}          4        0.03       73.50
{txt}                           Semi dur {c |}{res}          6        0.05       73.54
{txt}                           Semi-dur {c |}{res}          1        0.01       73.55
{txt}                      Sous  apattam {c |}{res}         13        0.10       73.65
{txt}                      Sous  appatam {c |}{res}          2        0.02       73.67
{txt}                        Sous  arbre {c |}{res}          2        0.02       73.69
{txt}                     Sous  paillote {c |}{res}          1        0.01       73.69
{txt}                    Sous  un  arbre {c |}{res}         10        0.08       73.77
{txt}                     Sous  un arbre {c |}{res}          6        0.05       73.82
{txt}                        Sous apatam {c |}{res}          1        0.01       73.83
{txt}                       Sous apattam {c |}{res}          7        0.06       73.89
{txt}                       Sous appatam {c |}{res}          2        0.02       73.90
{txt}                         Sous arbre {c |}{res}         15        0.12       74.02
{txt}                    Sous la veranda {c |}{res}          1        0.01       74.03
{txt}                     Sous paillotte {c |}{res}          1        0.01       74.04
{txt}                     Sous palmerais {c |}{res}          1        0.01       74.05
{txt}                       Sous palmier {c |}{res}          1        0.01       74.05
{txt}                     Sous un  arbre {c |}{res}          1        0.01       74.06
{txt}                    Sous un appatam {c |}{res}          1        0.01       74.07
{txt}                      Sous un arbre {c |}{res}          6        0.05       74.12
{txt}                     Sous un hangar {c |}{res}          3        0.02       74.14
{txt}                  Sous un paillotte {c |}{res}          1        0.01       74.15
{txt}                                  T {c |}{res}          2        0.02       74.17
{txt}                                 Te {c |}{res}          2        0.02       74.18
{txt}                         Tere battu {c |}{res}          4        0.03       74.21
{txt}                        Tere battue {c |}{res}          1        0.01       74.22
{txt}                          Tere batu {c |}{res}          1        0.01       74.23
{txt}                          Terr batu {c |}{res}          1        0.01       74.24
{txt}                              Terre {c |}{res}        491        3.92       78.16
{txt}                       Terre  battu {c |}{res}         53        0.42       78.58
{txt}                      Terre  battue {c |}{res}         59        0.47       79.05
{txt}                      Terre  battur {c |}{res}          1        0.01       79.06
{txt}                     Terre  battute {c |}{res}          1        0.01       79.07
{txt}                        Terre  batu {c |}{res}          1        0.01       79.08
{txt}                       Terre  batue {c |}{res}          2        0.02       79.09
{txt}                      Terre  brique {c |}{res}          2        0.02       79.11
{txt}                     Terre  briques {c |}{res}          2        0.02       79.12
{txt}                       Terre  bât u {c |}{res}          1        0.01       79.13
{txt}                        Terre  bâti {c |}{res}          1        0.01       79.14
{txt}                       Terre  bâtie {c |}{res}          3        0.02       79.16
{txt}                        Terre  bâtu {c |}{res}          3        0.02       79.19
{txt}                    Terre  de barre {c |}{res}         19        0.15       79.34
{txt}                      Terre  pétrie {c |}{res}          2        0.02       79.35
{txt}                       Terre  rouge {c |}{res}         13        0.10       79.46
{txt}                      Terre -battue {c |}{res}          2        0.02       79.47
{txt}                     Terre De barre {c |}{res}          1        0.01       79.48
{txt}                    Terre argileuse {c |}{res}          2        0.02       79.50
{txt}                        Terre battu {c |}{res}        670        5.35       84.85
{txt}                 Terre battu+ciment {c |}{res}          1        0.01       84.86
{txt}                       Terre battue {c |}{res}      1,036        8.27       93.13
{txt}      Terre battue ,brique de terre {c |}{res}          2        0.02       93.14
{txt}       Terre battue,brique de terre {c |}{res}          1        0.01       93.15
{txt}                      Terre battues {c |}{res}          3        0.02       93.17
{txt}                         Terre batu {c |}{res}          9        0.07       93.25
{txt}                        Terre batue {c |}{res}          1        0.01       93.25
{txt}                       Terre batues {c |}{res}          2        0.02       93.27
{txt}                         Terre bâti {c |}{res}          1        0.01       93.28
{txt}                        Terre bâtie {c |}{res}        176        1.41       94.68
{txt}                       Terre bâttue {c |}{res}          1        0.01       94.69
{txt}                         Terre bâtu {c |}{res}          3        0.02       94.71
{txt}                     Terre de barre {c |}{res}         81        0.65       95.36
{txt}                       Terre de bas {c |}{res}         16        0.13       95.49
{txt}                   Terre et briques {c |}{res}          1        0.01       95.50
{txt}                        Terre pétri {c |}{res}        130        1.04       96.54
{txt}                       Terre pétrie {c |}{res}        162        1.29       97.83
{txt}                        Terre rouge {c |}{res}        139        1.11       98.94
{txt}                   Terre stabilisée {c |}{res}          2        0.02       98.95
{txt}                        Terre terre {c |}{res}          1        0.01       98.96
{txt}                      Terre à barre {c |}{res}          1        0.01       98.97
{txt}                        Terre,battu {c |}{res}          1        0.01       98.98
{txt}                       Terre- battu {c |}{res}          2        0.02       98.99
{txt}                      Terre- battue {c |}{res}         55        0.44       99.43
{txt}                       Terre-battue {c |}{res}         10        0.08       99.51
{txt}            Terre-battue  et brique {c |}{res}          1        0.01       99.52
{txt}                       Terre-pétrie {c |}{res}          2        0.02       99.54
{txt}                        Terrebattue {c |}{res}          1        0.01       99.54
{txt}                        Terrebuttue {c |}{res}          1        0.01       99.55
{txt}                             Terres {c |}{res}         23        0.18       99.74
{txt}                     Terres  batues {c |}{res}          2        0.02       99.75
{txt}                    Terres  briques {c |}{res}          1        0.01       99.76
{txt}                  Terres  et brique {c |}{res}          1        0.01       99.77
{txt}                      Terres batues {c |}{res}         13        0.10       99.87
{txt}                       Terrr battue {c |}{res}          1        0.01       99.88
{txt}                              Terry {c |}{res}          1        0.01       99.89
{txt}                       Terré battue {c |}{res}          1        0.01       99.90
{txt}                       Terte battue {c |}{res}          1        0.01       99.90
{txt}                      Tertes batues {c |}{res}          1        0.01       99.91
{txt}                               Toil {c |}{res}          1        0.01       99.92
{txt}                               Tole {c |}{res}          1        0.01       99.93
{txt}                              Têrre {c |}{res}          1        0.01       99.94
{txt}                               Tôle {c |}{res}          7        0.06       99.99
{txt}                              battu {c |}{res}          1        0.01      100.00
{txt}{hline 36}{c +}{hline 35}
                              Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. gen materialh=surveycb58
{txt}(6,417 missing values generated)

{com}. gen house=.
{txt}(12,526 missing values generated)

{com}. 
. replace house=1 if materialh=="A cot√© d'un mur" | materialh=="A c√¥t√©  d'un  mur"  | materialh=="A c√¥t√©  d'un mur" | materialh=="A c√¥t√© d'un  mur" | materialh=="A c√¥t√© d'un mur"
{txt}(0 real changes made)

{com}. 
. replace house=2 if materialh=="A c√¥t√©  d'un apattam" | materialh=="Apatam"  | materialh=="Apattam" | materialh=="Appatam" | materialh=="Sous un appatam" | materialh=="Sous  apattam" ///
> | materialh=="Sous  appatam" | materialh=="Sous apatam" | materialh=="Sous apattam" | materialh=="Sous appatam"
{txt}(54 real changes made)

{com}. 
. replace house=3 if materialh=="Mat√©riaux  pr√©caire" | materialh=="Mat√©riaux  pr√©caires" | materialh=="Mat√©riaux primaire" | materialh=="Mat√©riaux pr√© caires" | materialh=="Mat√©riaux pr√©caire" | materialh=="Mat√©riaux pr√©caires" 
{txt}(0 real changes made)

{com}. 
. replace house=4 if materialh=="Avec  du ciment" | materialh=="Ciment" | materialh=="Briques en ciment" | materialh=="Briques des  ciment" | materialh=="Briques de ciment" | materialh=="Brique de ciment"  
{txt}(188 real changes made)

{com}. 
. replace house=5 if materialh=="Bambou" | materialh=="En bambou"
{txt}(67 real changes made)

{com}. 
. replace house=6 if materialh=="Argil" | materialh=="Argile" | materialh=="Bamko" | materialh=="Boue" | materialh=="Banci" | materialh=="Banco" | materialh=="Banka"|materialh=="Banko"| materialh=="Banvo" ///
> |materialh=="Brique en  banco"| materialh=="Brique en banco" | materialh=="Barre de terre" | materialh=="Brique  de terre" | materialh=="Brique de terre" ///
> | materialh=="Brique de terre battue" | materialh=="Brique de terre battu"| materialh=="Brique de terre, terre battue" | materialh=="Brique de terre,terre battue" ///
> | materialh=="Brique" | materialh=="Bique" | materialh=="Brique en banco et en terre  battue " | materialh=="Brique en terre battue" | materialh=="Brique et terre" ///
> | materialh=="Brique et terre battue"| materialh=="Brique terre battue" | materialh=="Briques" | materialh=="Briques  de terre en battue" | materialh=="Briques  en terre battue" ///
> | materialh=="Briques  et terre batu" | materialh=="Briques  stabilis√©e" | materialh=="Briques de terre  battue" | materialh=="Briques de terre battu" | materialh=="Briques de terre battue" ///
> | materialh=="Briques en terre  battue"| materialh=="Briques en terre battue" | materialh=="Briques en terre batu" | materialh=="Briques et terre- battue" | materialh=="Briques rouge" ///
> | materialh=="Briques terre battue" | materialh=="Brque" | materialh=="Bsnco" | materialh=="Clai" | materialh=="Dans une cl√¥ture en brique" | materialh=="Demi banko" | materialh=="En banco" ///
> | materialh=="En banko" | materialh=="En clai" | materialh=="En clair" | materialh=="En claire" | materialh=="En terre battu" | materialh=="En terre battue" | materialh=="Maison a terre battue" ///
> | materialh=="Tere battu" | materialh=="Tere battue" | materialh=="Tere batu" | materialh=="Terr batu" | materialh=="Terre" | materialh=="Terre  battu" | materialh=="Terre  battue" ///
> | materialh=="Terre  battur" | materialh=="Terre  battute" | materialh=="Terre  batu" | materialh=="Terre  batue" | materialh=="Terre  brique" | materialh=="Terre  briques" ///
> | materialh=="Terre  b√¢t u" | materialh=="Terre  b√¢ti" | materialh=="Terre  b√¢tie"| materialh=="Terre  b√¢tu"| materialh=="Terre  de barre" | materialh=="Terre  p√©trie" ///
> | materialh=="Terre  rouge" | materialh=="Terre -battue" | materialh=="Terre De barre" | materialh=="Terre argileuse" | materialh=="Terre battu" | materialh=="Terre battue" ///
> | materialh=="Terre battue ,brique de terre" | materialh=="Terre battue,brique de terre" | materialh=="Terre battues" | materialh=="Terre batu" | materialh=="Terre batue" ///
> | materialh=="Terre batues" | materialh=="Terre b√¢ti" | materialh=="Terre b√¢tie" | materialh=="Terre b√¢ttue" | materialh=="Terre b√¢tu" | materialh=="Terre de barre" ///
> | materialh=="Terre de bas" | materialh=="Terre et briques" | materialh=="Terre p√©tri" | materialh=="Terre p√©trie" | materialh=="Terre rouge" | materialh=="Terre stabilis√©e" ///
> | materialh=="Terre terre" | materialh=="Terre √† barre" | materialh=="Terre,battu" | materialh=="Terre- battu" | materialh=="Terre- battue" | materialh=="Terre-battue" ///
> | materialh=="Terre-battue  et brique" | materialh=="Terre-p√©trie" | materialh=="Terrebattue" | materialh=="Terrebuttue" | materialh=="Terres" | materialh=="Terres  batues" ///
> | materialh=="Terres  briques" | materialh=="Terres  et brique" | materialh=="Terres batues" | materialh=="Terrr battue" | materialh=="Terry" | materialh=="Terr√© battue" ///
> | materialh=="Terte battue" | materialh=="Tertes batues" | materialh=="T√™rre" | materialh=="battu" 
{txt}(4,637 real changes made)

{com}. 
. replace house=7 if materialh=="Briques de terre  battue + ciment" | materialh=="Briques de terre battue + ciment" | materialh=="Briques de terre battue +ciment" ///
> | materialh=="Briques dee terre battue + ciment" | materialh=="Briques dr terre  battue +ciment" | materialh=="Briques dr terre  battue +ciment" | materialh=="Briques terre battue + ciment" ///
> | materialh=="Briques terre battue +ciment" | materialh=="M√©lange de ciment et terre battu" | materialh=="Terre battu+ciment" 
{txt}(24 real changes made)

{com}. 
. replace house=8 if materialh=="Bois" 
{txt}(17 real changes made)

{com}. 
. replace house=9 if materialh=="Toile" | materialh=="Tole"
{txt}(1 real change made)

{com}. 
. replace house=10 if materialh=="Dur" | materialh=="Dure" | materialh=="En briques dures" | materialh=="En dur" | materialh=="En dure" | materialh=="Endur" | materialh=="Endure" 
{txt}(55 real changes made)

{com}. 
. replace house=11 if materialh=="Pagne" 
{txt}(1 real change made)

{com}. 
. replace house=12 if materialh=="MATERIAUX Definitifs" | materialh=="Mat√©riaux  definitif" | materialh=="Mat√©riaux  definitifs" | materialh=="Mat√©riaux  defitifs" | materialh=="Mat√©riaux  d√©finitif" ///
>  | materialh=="Mat√©riaux  d√©finitifs" |  materialh=="Mat√©riaux definitifs" | materialh=="Mat√©riaux d√©finitif" | materialh=="Mat√©riaux d√©finitifs"
{txt}(1 real change made)

{com}. 
. replace house=13 if materialh=="Paillasson" | materialh=="Paille" | materialh=="Pailles" | materialh=="Chaume"  | materialh=="Sous un paillotte" | materialh=="Sous paillotte" 
{txt}(17 real changes made)

{com}. 
. replace house=14 if materialh=="Mat√©riaux  pr√©caire" | materialh=="Mat√©riaux  pr√©caires" | materialh=="Mat√©riaux primaire" | materialh=="Mat√©riaux pr√© caires" | materialh=="Mat√©riaux pr√©caire" | materialh=="Mat√©riaux pr√©caires" 
{txt}(0 real changes made)

{com}. 
. replace house=15 if materialh=="Mat√©riaux  locaux" | materialh=="Mat√©riaux locaux" 
{txt}(0 real changes made)

{com}. 
. tab house, missing

      {txt}house {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          2 {c |}{res}         54        0.43        0.43
{txt}          4 {c |}{res}        188        1.50        1.93
{txt}          5 {c |}{res}         67        0.53        2.47
{txt}          6 {c |}{res}      4,637       37.02       39.49
{txt}          7 {c |}{res}         24        0.19       39.68
{txt}          8 {c |}{res}         17        0.14       39.81
{txt}          9 {c |}{res}          1        0.01       39.82
{txt}         10 {c |}{res}         55        0.44       40.26
{txt}         11 {c |}{res}          1        0.01       40.27
{txt}         12 {c |}{res}          1        0.01       40.28
{txt}         13 {c |}{res}         17        0.14       40.41
{txt}          . {c |}{res}      7,464       59.59      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. 
. /*
> 1=Side wall
> 2=Apattam
> 3=Palm trees, under a tree, under a palm
> 4=Cement or Cement Bricks
> 5=Bamboo
> 6=MUD AND CLAY
> 7=mud/clay and cement
> 8=Wood
> 9=Metal Sheet
> 10=Hard material
> 11= cloth
> 12=Definitive materials
> 13=Straw
> 14=precarious materials
> 15= Local materials
> 
> */
. 
. gen house_poverty=.
{txt}(12,526 missing values generated)

{com}. 
. replace house_poverty=1 if house==2 | house==3 | house==11 | house== 13 | house==14
{txt}(72 real changes made)

{com}. 
. 
. replace house_poverty=2 if house==6 | house==5 | house==8
{txt}(4,721 real changes made)

{com}. 
. replace house_poverty=3 if house==7 | house==8 
{txt}(41 real changes made)

{com}. 
. replace house_poverty=4 if house==4 | house==10 | house==12 
{txt}(244 real changes made)

{com}. /*
> house_poverty: 1-4 (lower values indicate more poverty)
> 1- Apattam, Palm trees, under a tree, under a palm, cloth, straw, precarious materials.
> 2- Mud, Clay, Mud and Clay, Bricks, 
> 3- Mud/CLay mixed with Cement, Wood
> 4- Cement, Hard Materials, Definitive materials, Metal sheet (1 observation). 
> */
. 
. label variable house_pover "Poverty (housing material)"
{txt}
{com}. 
. ************ Material of Roof ************
. 
. gen roofmat=surveycb59
{txt}(6,535 missing values generated)

{com}. gen roof=.
{txt}(12,526 missing values generated)

{com}. 
. replace roof=1 if roofmat=="Apattam"
{txt}(1 real change made)

{com}. 
. replace roof=2 if roofmat=="Banco" | roofmat=="Banko" | roofmat=="Brigue" | roofmat=="Brique de terre" ///
> | roofmat=="Briques" | roofmat=="T" | roofmat=="Terre" | roofmat=="Terre battu" | roofmat=="Terre battue" | roofmat=="Terre p√©trie" 
{txt}(20 real changes made)

{com}. 
. replace roof=3 if roofmat=="Chaume" | roofmat=="En feuille de branche" | roofmat=="Des paille" | roofmat=="En feuille de branche" ///
> | roofmat=="En paille" | roofmat=="Feuille de paille" | roofmat=="Feuille de palme" | roofmat=="Feuille du  palme" ///
> | roofmat=="Feuilles  de branche" | roofmat=="Paill" | roofmat=="Paillasson" | roofmat=="Paille" | roofmat=="Pailles" 
{txt}(440 real changes made)

{com}. 
. replace roof=4 if roofmat=="Feuille de tole" | roofma=="Feuilles  de tole" | roofmat=="Feuilles  de toles" ///
> | roofmat=="Feuilles  de t√¥le" | roofmat=="Feuilles de toles" | roofmat=="Feuilles de toltes" ///
> | roofmat=="Feuilles, de toles" | roofmat=="Les toles" | roofmat=="Toil" | roofmat=="Toile" | roofmat=="Toke" ///
> | roofmat=="Tol" | roofmat=="Tole" | roofmat=="Tole  ondulee" | roofmat=="Tole ondulee" | roofmat=="Tole ondul√©e" ///
> | roofmat=="Toles" | roofmat=="Tolle" | roofmat=="Tolles" | roofmat=="Tolr" | roofmat=="Tol√©r√©" | roofmat=="To√Æl" 
{txt}(894 real changes made)

{com}. 
. replace roof=5 if roofmat=="Tuile" | roofmat=="Tuiles" | roofmat=="Tule" | roofmat=="Tules" | roofmat=="Tulle" ///
> | roofmat=="Turle" | roofmat=="T√¥ke" | roofmat=="T√¥le" | roofmat=="T√¥le  dalles" | roofmat=="T√¥le  et dalles" ///
> | roofmat=="T√¥le T√¥le" | roofmat=="T√¥le de" | roofmat=="T√¥le et paille" | roofmat=="T√¥le et  paille" ///
> | roofmat=="T√¥le ondulee" | roofmat=="T√¥le ondul√©e" | roofmat=="T√¥les" | roofmat=="Y T√¥le" 
{txt}(70 real changes made)

{com}. 
. replace roof=6 if roofmat=="Ciment"
{txt}(3 real changes made)

{com}. 
. replace roof=7 if roofmat=="Pagne" 
{txt}(49 real changes made)

{com}. 
. /* 
> 1=apattam
> 2= mud or clay
> 3= straw, branches, palms
> 4= metal sheet 
> 5=Tiles
> 6= cement
> 7=cloth
> */
. 
. gen roof_poverty=.
{txt}(12,526 missing values generated)

{com}. 
. replace roof_poverty=1 if roof==1 | roof==3 | roof==6 | roof==7
{txt}(493 real changes made)

{com}. 
. replace roof_poverty=2 if roof==2 | roof==4 
{txt}(914 real changes made)

{com}. 
. replace roof_poverty=3 if roof==5
{txt}(70 real changes made)

{com}. 
. replace roof_poverty=4 if roof==6
{txt}(3 real changes made)

{com}. 
. tab roof_poverty, missing

{txt}roof_povert {c |}
          y {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          1 {c |}{res}        490        3.91        3.91
{txt}          2 {c |}{res}        914        7.30       11.21
{txt}          3 {c |}{res}         70        0.56       11.77
{txt}          4 {c |}{res}          3        0.02       11.79
{txt}          . {c |}{res}     11,049       88.21      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. ***** Create index of poverty
. 
. * Run little program for creating Anderson indices
. do genindex.do
{txt}
{com}. *ssc install center
. cap program drop _all
{txt}
{com}. program genindex
{txt}  1{com}. 
.         version 12
{txt}  2{com}.         syntax varlist [aw] , nv(string)
{txt}  3{com}.         
.         *qui {c -(}
.                 center `varlist' , pre(z_) st
{txt}  4{com}. 
.         // #1-a Mean of those zscores, 0/1 at median: M
.                 egen `nv'M = rowmean(z_*)
{txt}  5{com}.                 if "`exp'" != "" {c -(}
{txt}  6{com}.                         qui su `nv'M [weight `exp'] , de
{txt}  7{com}.                         {c )-}
{txt}  8{com}.                 if "`exp'" == "" {c -(}
{txt}  9{com}.                         qui su `nv'M , de
{txt} 10{com}.                         {c )-}
{txt} 11{com}.                 gen `nv'M_B = (`nv'M > r(p50))
{txt} 12{com}.                 
.         // #1-b Factor, 0/1 at median: F
.                 factor z_*
{txt} 13{com}.                 predict `nv'F
{txt} 14{com}.                 su `nv'F , de
{txt} 15{com}.                 gen `nv'F_B = (`nv'F > r(p50))
{txt} 16{com}.                 
.         // #1-c Anderson ('08) wgt'd by Var-Cov mat, 0/1 at median: A
.                 tempname R J T A
{txt} 17{com}.                 mat accum `R' = `varlist' , nocons dev
{txt} 18{com}.                 mat `R' = syminv(`R'/r(N))
{txt} 19{com}.                 mat `J' = J(colsof(`R') , 1 , 1)
{txt} 20{com}. 
.                 local c = 1
{txt} 21{com}.                 while `c' <= colsof(`R') {c -(}
{txt} 22{com}.                         mat `T' = `R'[`c' , 1..colsof(`R')]
{txt} 23{com}.                         mat `A' = `T'*`J'
{txt} 24{com}.                         global wgt`c' = `A'[1 , 1]
{txt} 25{com}.                         local ++c
{txt} 26{com}.                         {c )-}
{txt} 27{com}.                 
.                 tempvar samp1 outp1
{txt} 28{com}.                 gen `samp1' = 0
{txt} 29{com}.                 gen `outp1' = 0
{txt} 30{com}.                 local c = 1
{txt} 31{com}.                 foreach z in `varlist' {c -(}
{txt} 32{com}.                         replace `samp1' = `samp1' + $wgt`c'
{txt} 33{com}.                         replace z_`z' = 0 if missing(`z') 
{txt} 34{com}.                         replace `outp1' = z_`z'*($wgt`c') + `outp1'
{txt} 35{com}.                         local ++c
{txt} 36{com}.                         {c )-}
{txt} 37{com}. 
.                 replace `outp1' = `outp1'/`samp1'
{txt} 38{com}.                 rename `samp1' n_`nv'_var
{txt} 39{com}.                 rename `outp1' `nv'A
{txt} 40{com}. 
.                 su `nv'A , de
{txt} 41{com}.                 gen `nv'A_B = (`nv'A > r(p50))
{txt} 42{com}.                 
.                 local ab M F A
{txt} 43{com}.                 local ful Mean Factor Anderson
{txt} 44{com}.                 forval n = 1/3 {c -(}
{txt} 45{com}.                         local a : word `n' of `ab'
{txt} 46{com}.                         local b : word `n' of `ful'
{txt} 47{com}.                         lab var `nv'`a' "`nv'`a': `nv' `b'"
{txt} 48{com}.                         lab var `nv'`a'_B "`nv'`a'_B: `nv' `b' 0/1"
{txt} 49{com}.                         {c )-}
{txt} 50{com}.                 
.                 drop z_*
{txt} 51{com}.                 macro drop _all
{txt} 52{com}.                 *{c )-}      
. end
{txt}
{com}. 
{txt}end of do-file

{com}. 
. genindex roof_poverty house_poverty electricity, nv(poverty)
{txt}(6412 missing values generated)
(obs=1,370)

Factor analysis/correlation{col 50}Number of obs    = {res}     1,370
{col 5}{txt}Method: principal factors{col 50}Retained factors =   {res}       1
{col 5}{txt}Rotation: (unrotated){col 50}Number of params =   {res}       3

{txt}{col 5}{hline 13}{c TT}{hline 60}
{col 5}     Factor  {c |} {ralign 12:Eigenvalue}   Difference        Proportion   Cumulative
{col 5}{hline 13}{c +}{hline 60}
{col 5}{ralign 11:Factor1}  {c |}{res}      0.48815      0.51039            1.9851       1.9851
{txt}{col 5}{ralign 11:Factor2}  {c |}{res}     -0.02223      0.19778           -0.0904       1.8947
{txt}{col 5}{ralign 11:Factor3}  {c |}{res}     -0.22002            .           -0.8947       1.0000
{txt}{col 5}{hline 13}{c BT}{hline 60}
{col 5}LR test: independent vs. saturated:  chi2({res}3{txt})  ={res}  181.20{txt} Prob>chi2 ={res} 0.0000

{txt}Factor loadings (pattern matrix) and unique variances

{space 4}{hline 13}{c  TT}{hline 10}{c  TT}{hline 14}
{space 4}{space 0}{ralign 12:Variable}{space 1}{c |}{space 1}{ralign 8:Factor1}{space 1}{c |}{space 1}{ralign 12:Uniqueness}{space 1}
{space 4}{hline 13}{c   +}{hline 10}{c   +}{hline 14}
{space 4}{space 0}{ralign 12:z_roof_pov~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf:  0.4668}}}{space 1}{c |}{space 1}{center 12:{res:{sf:    0.7821}}}{space 1}
{space 4}{space 0}{ralign 12:z_house_po~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf:  0.1966}}}{space 1}{c |}{space 1}{center 12:{res:{sf:    0.9613}}}{space 1}
{space 4}{space 0}{ralign 12:z_electric~e}{space 1}{c |}{space 1}{ralign 8:{res:{sf:  0.4812}}}{space 1}{c |}{space 1}{center 12:{res:{sf:    0.7684}}}{space 1}
{space 4}{hline 13}{c  BT}{hline 10}{c  BT}{hline 14}
(regression scoring assumed)

{p 0 0 2}Scoring coefficients (method = regression){p_end}

{space 4}{hline 13}{c  TT}{hline 10}
{space 4}{space 0}{ralign 12:Variable}{space 1}{c |}{space 1}{ralign 8:Factor1}{space 1}
{space 4}{hline 13}{c   +}{hline 10}
{space 4}{space 0}{ralign 12:z_roof_pov~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf: 0.33909}}}{space 1}
{space 4}{space 0}{ralign 12:z_house_po~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf: 0.12862}}}{space 1}
{space 4}{space 0}{ralign 12:z_electric~e}{space 1}{c |}{space 1}{ralign 8:{res:{sf: 0.35363}}}{space 1}
{space 4}{hline 13}{c  BT}{hline 10}


                     Scores for factor 1
{hline 61}
      Percentiles      Smallest
 1%    {res}-.6931067      -1.105848
{txt} 5%    {res}-.6931067      -1.105848
{txt}10%    {res}-.6931067      -1.105848       {txt}Obs         {res}      1,370
{txt}25%    {res}-.6931067      -1.105848       {txt}Sum of Wgt. {res}      1,370

{txt}50%    {res}-.0531497                      {txt}Mean          {res} 3.74e-09
                        {txt}Largest       Std. Dev.     {res} .5947756
{txt}75%    {res} .5868074        2.22437
{txt}90%    {res} .7589313        2.22437       {txt}Variance      {res}  .353758
{txt}95%    {res} .7589313        2.22437       {txt}Skewness      {res} .6070977
{txt}99%    {res} 1.584414        2.22437       {txt}Kurtosis      {res} 2.975696
{txt}(obs=1,370)
(12,526 real changes made)
(11,049 real changes made)
(1,477 real changes made)
(12,526 real changes made)
(7,465 real changes made)
(5,061 real changes made)
(12,526 real changes made)
(6,416 real changes made)
(6,110 real changes made)
(6,114 real changes made)
{res}
                          {txt}povertyA
{hline 61}
      Percentiles      Smallest
 1%    {res}-.6280052       -1.36054
{txt} 5%    {res}-.4121895       -1.36054
{txt}10%    {res}-.4121895       -1.36054       {txt}Obs         {res}     12,526
{txt}25%    {res}-.3460428       -1.36054       {txt}Sum of Wgt. {res}     12,526

{txt}50%    {res}        0                      {txt}Mean          {res}-9.34e-09
                        {txt}Largest       Std. Dev.     {res} .4461729
{txt}75%    {res}        0        2.50518
{txt}90%    {res} .6561891        2.50518       {txt}Variance      {res} .1990703
{txt}95%    {res} .7223359        2.50518       {txt}Skewness      {res} 1.698536
{txt}99%    {res}  2.12126        2.50518       {txt}Kurtosis      {res} 8.498647
{txt}
{com}. 
. replace povertyA=povertyA*-1
{txt}(6,114 real changes made)

{com}. **Higher values of povertyA indicate more poverty (lower income) 
. 
. 
. label variable school1 "School in the community"
{txt}
{com}. label variable borehole1 "Borehole in the community"
{txt}
{com}. label variable clinic1 "Health clinic in the community"
{txt}
{com}. 
. 
. 
. ******
. ** Re-order variables so cleaned vars are at the top
. 
. order commune quartier blid treatment treatment condition incumbent_vote turnout  coethnic female age urban educyears house_ electricity coethnic margin conseil_chef professional jeunes womens_group politique ///
>         information_source1-information_source4 discuss1-discuss3 secret know_village_  ///
>         consequences help goodnewsrelative2 goodnews votedincumbent2011 overall_prior effort_prior corruption_prior p1-p4 ///
>         school1 clinic1 borehole1
{txt}
{com}. 
{txt}end of do-file

{com}.                 areg incumbent_vote treatment if goodnews==1, absorb(blid) vce(cluster quartier)

{txt}Linear regression, absorbing indicators{col 49}Number of obs{col 67}= {res}     1,670
{txt}{col 49}F({res}   1{txt},{res}    135{txt}){col 67}= {res}      4.03
{txt}{col 49}Prob > F{col 67}= {res}    0.0466
{txt}{col 49}R-squared{col 67}= {res}    0.1800
{txt}{col 49}Adj R-squared{col 67}= {res}    0.1634
{txt}{col 49}Root MSE{col 67}= {res}    0.4573

{txt}{ralign 78:(Std. Err. adjusted for {res:136} clusters in quartier)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}incumbent_~e{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2} .0698813{col 26}{space 2} .0347894{col 37}{space 1}    2.01{col 46}{space 3}0.047{col 54}{space 4} .0010786{col 67}{space 3} .1386839
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}  .455276{col 26}{space 2} .0302011{col 37}{space 1}   15.07{col 46}{space 3}0.000{col 54}{space 4} .3955475{col 67}{space 3} .5150045
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
        blid {c |}   absorbed                                      (33 categories)

{com}.                                 est store Survey
{txt}
{com}. 
. 
. 
.         coefplot Official Survey, vertical  yline(0) keep(treatment)  ///
>         ylabel(, angle(horizontal)) graphr(color(white)) xlabel(, noticks)
{res}{txt}
{com}. 
.         
. cap                     graph export Drafts/JEPS/figures/treatment_goodnewsCIs.pdf, as(pdf) replace     
{txt}
{com}. 
. ** 
.                 
. restore
{txt}
{com}. 
. 
. areg official_vote treatment if survey_vote~=.&goodnews==0, absorb(blid)                
{res}
{txt}Linear regression, absorbing indicators{col 49}Number of obs{col 67}= {res}       102
{txt}{col 49}F({res}   1{txt},{res}     74{txt}){col 67}= {res}      0.01
{txt}{col 49}Prob > F{col 67}= {res}    0.9304
{txt}{col 49}R-squared{col 67}= {res}    0.7472
{txt}{col 49}Adj R-squared{col 67}= {res}    0.6549
{txt}{col 49}Root MSE{col 67}= {res}    0.1294

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}official_v~e{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2} .0027579{col 26}{space 2} .0314768{col 37}{space 1}    0.09{col 46}{space 3}0.930{col 54}{space 4} -.059961{col 67}{space 3} .0654767
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .3860341{col 26}{space 2} .0272681{col 37}{space 1}   14.16{col 46}{space 3}0.000{col 54}{space 4} .3317013{col 67}{space 3} .4403669
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
        blid {c |}         F(26, 74) = {res}     8.409   0.000          {txt}(27 categories)

{com}.                 est store Official
{txt}
{com}. 
. *preserve
. 
. use "survey_merge.dta", clear
{txt}
{com}. 
.         * Run do file
.         do 01_survey_clean.do
{txt}
{com}. 
. set more off
{txt}
{com}. 
. /*
> NOTE ON SURVEY DATA: About 6000 people were surveyed at baseline.  
> Another 6000 were treated (publicly or privately), but were not surveyed
> About 3000 are in the sample at endline
> */
. 
. 
. **** Treatment variables ********
.         
. tab condition, missing

       {txt}condition {c |}      Freq.     Percent        Cum.
{hline 17}{c +}{hline 35}
Control + Survey {c |}{res}      1,217        9.72        9.72
{txt}            T1T3 {c |}{res}      2,343       18.71       28.42
{txt}            T1T4 {c |}{res}      2,809       22.43       50.85
{txt}            T2T3 {c |}{res}      2,360       18.84       69.69
{txt}            T2T4 {c |}{res}      3,797       30.31      100.00
{txt}{hline 17}{c +}{hline 35}
           Total {c |}{res}     12,526      100.00
{txt}
{com}. 
.         gen control=0 if condition=="T1T4"|condition=="T1T3"|condition=="T2T3"|condition=="T2T4"
{txt}(1,217 missing values generated)

{com}.         replace control=1 if condition=="Control + Survey"
{txt}(1,217 real changes made)

{com}.         tab control ,missing

    {txt}control {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}     11,309       90.28       90.28
{txt}          1 {c |}{res}      1,217        9.72      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}.         
. * create treatment indicator
. gen treatment=0
{txt}
{com}. replace treatment=1 if control!=1
{txt}(11,309 real changes made)

{com}. tab treatment, missing

  {txt}treatment {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,217        9.72        9.72
{txt}          1 {c |}{res}     11,309       90.28      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. ** indicators for treatment conditions
. encode condition, gen(condition_numeric) // private is 2 and 4, public is 3 and 5, control is 1
{txt}
{com}. tab condition_numeric, missing  

{txt}condition_numeri {c |}
               c {c |}      Freq.     Percent        Cum.
{hline 17}{c +}{hline 35}
Control + Survey {c |}{res}      1,217        9.72        9.72
{txt}            T1T3 {c |}{res}      2,343       18.71       28.42
{txt}            T1T4 {c |}{res}      2,809       22.43       50.85
{txt}            T2T3 {c |}{res}      2,360       18.84       69.69
{txt}            T2T4 {c |}{res}      3,797       30.31      100.00
{txt}{hline 17}{c +}{hline 35}
           Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. * some people were treated but not surveyed
. generate nosurvey=0
{txt}
{com}. replace nosurvey=1 if typet3==3 | typet4==2
{txt}(6,174 real changes made)

{com}. 
. gen infoonly=.
{txt}(12,526 missing values generated)

{com}. replace infoonly=1 if condition=="T1T3" | condition=="T1T4"
{txt}(5,152 real changes made)

{com}. replace infoonly=0 if condition=="T2T3" | condition=="T2T4" | control==1
{txt}(7,374 real changes made)

{com}. tab infoonly, missing

   {txt}infoonly {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      7,374       58.87       58.87
{txt}          1 {c |}{res}      5,152       41.13      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. gen civics=.
{txt}(12,526 missing values generated)

{com}. replace civics=1 if condition=="T2T3" | condition=="T2T4"
{txt}(6,157 real changes made)

{com}. replace civics=0 if condition=="T1T3" | condition=="T1T4" | control==1
{txt}(6,369 real changes made)

{com}. tab civics, missing

     {txt}civics {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      6,369       50.85       50.85
{txt}          1 {c |}{res}      6,157       49.15      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. **** Indicator for block
. replace block = 4 if dosage==0 // villages in low dose all in same block
{txt}(1,243 real changes made)

{com}. 
. egen blid = group(commune block)  // generate block that combines block/commune
{txt}
{com}. 
. 
. ****** DV: vote for incumbent at endline
. * also do self reported turnout (for appendix)
. 
. tab endlineeq6

   {txt}A présent, nous {c |}
      aimerions en {c |}
savoir plus sur le {c |}
 parti pour lequel {c |}
     vous avez vot {c |}      Freq.     Percent        Cum.
{hline 19}{c +}{hline 35}
               Non {c |}{res}      1,512       49.59       49.59
{txt}               Oui {c |}{res}      1,524       49.98       99.57
{txt}       Ne sait pas {c |}{res}          8        0.26       99.84
{txt}Refuse de répondre {c |}{res}          5        0.16      100.00
{txt}{hline 19}{c +}{hline 35}
             Total {c |}{res}      3,049      100.00
{txt}
{com}. recode endlineeq6 (98 99 = .), gen(incumbent_vote)
{txt}(13 differences between endlineeq6 and incumbent_vote)

{com}. 
. recode endlineeq3 (98 99 3= .), gen(turnout)
{txt}(1 differences between endlineeq3 and turnout)

{com}. 
. ************************************************************
. **** Main IV: Coethnic with incumbent
. tab surveycb24, missing

 {txt}En pensant {c |}
          à {c |}
  ${c -(}dname{c )-}, {c |}
diriez-vous {c |}
   que vous {c |}
partagez le {c |}
       même {c |}
     groupe {c |}
 ethnique a {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        Non {c |}{res}      2,317       18.50       18.50
{txt}        Oui {c |}{res}      3,755       29.98       48.48
{txt}          . {c |}{res}      6,454       51.52      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. tab surveycb24 if incumbent_vote~=., missing

 {txt}En pensant {c |}
          à {c |}
  ${c -(}dname{c )-}, {c |}
diriez-vous {c |}
   que vous {c |}
partagez le {c |}
       même {c |}
     groupe {c |}
 ethnique a {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        Non {c |}{res}      1,041       34.29       34.29
{txt}        Oui {c |}{res}      1,978       65.15       99.44
{txt}          . {c |}{res}         17        0.56      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      3,036      100.00
{txt}
{com}. 
. gen coethnic= surveycb24
{txt}(6,454 missing values generated)

{com}.         label variable coethnic "Coethnic with incumbent"
{txt}
{com}. 
.         
. ***********************************************
. ** Define "good" information, relative to priors
.         ** If don't know, we code based on whether legislator was better or worse than local
.         ** If priors = information, we code based on whether prior was negative or positive
.                 * rational is information would strengthen belief in prior if the same
. 
. recode surveycb29 (99=.) (4=1) (3=2) (2=3) (1=4), gen (performanceplenary) 
{txt}(6106 differences between surveycb29 and performanceplenary)

{com}. recode surveycb31 (99=.) (4=1) (3=2) (2=3) (1=4), gen (performancecommittee) 
{txt}(6104 differences between surveycb31 and performancecommittee)

{com}. recode surveycb33 (99=.) (4=1) (3=2) (2=3) (1=4), gen (performanceboth) 
{txt}(6105 differences between surveycb33 and performanceboth)

{com}.                 
. tab performanceboth, missing // this is the prior on overall performance, ranging from 1 (worst prior) to 4 (best prior)

  {txt}RECODE of {c |}
 surveycb33 {c |}
 (Nous vous {c |}
  avons dît {c |}
    que les {c |}
    députés {c |}
participent {c |}
 aux séance {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          1 {c |}{res}        587        4.69        4.69
{txt}          2 {c |}{res}        788        6.29       10.98
{txt}          3 {c |}{res}        913        7.29       18.27
{txt}          4 {c |}{res}        463        3.70       21.96
{txt}          . {c |}{res}      9,775       78.04      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. rename overall_departememt overall_departement
{res}{txt}
{com}. tab overall_departement, missing // this is the info we provided, ranging from 1 (best perf) to 4 (worst perf)

{txt}overall_dep {c |}
   artement {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          1 {c |}{res}      2,532       20.21       20.21
{txt}          2 {c |}{res}      4,849       38.71       58.93
{txt}          3 {c |}{res}      2,494       19.91       78.84
{txt}          4 {c |}{res}      2,571       20.53       99.36
{txt}          . {c |}{res}         80        0.64      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. recode overall_departement (99=.) (4=1) (3=2) (2=3) (1=4), gen (overall_dept_recode)
{txt}(12446 differences between overall_departement and overall_dept_recode)

{com}. gen goodnewsrelative2=1 if (performanceboth==1 & overall_dept_recode>1) | (performanceboth==2 & overall_dept_recode>2) | (performanceboth==3 & overall_dept_recode>2) | (performanceboth==4 & overall_dept_recode==4)
{txt}(10,944 missing values generated)

{com}. replace goodnewsrelative2=0 if (performanceboth==1 & overall_dept_recode==1) | (performanceboth==2 & overall_dept_recode<3) | (performanceboth==3 & overall_dept_recode<3) | (performanceboth==4 & overall_dept_recode<4)
{txt}(1,166 real changes made)

{com}. replace goodnewsrelative2=1 if (performanceboth==. & overall_dept_recode==3) | (performanceboth==. & overall_dept_recode==4)
{txt}(5,788 real changes made)

{com}. replace goodnewsrelative2=0 if (performanceboth==. & overall_dept_recode==2) | (performanceboth==. & overall_dept_recode==1)
{txt}(3,937 real changes made)

{com}. tab goodnewsrelative2, missing

{txt}goodnewsrel {c |}
     ative2 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      5,103       40.74       40.74
{txt}          1 {c |}{res}      7,370       58.84       99.58
{txt}          . {c |}{res}         53        0.42      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. summarize goodnewsrelative2

{txt}    Variable {c |}        Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 57}
goodnewsre~2 {c |}{res}     12,473    .5908763    .4916919          0          1
{txt}
{com}. 
. ** Also create good news measure that corresponds with Admin
.         * not conditional on priors
. 
. gen goodnews = 0 if overall_dept_recode==1 | overall_dept_recode==2
{txt}(7,461 missing values generated)

{com}.         replace goodnews = 1 if overall_dept_recode==3 | overall_dept_recode==4
{txt}(7,381 real changes made)

{com}. 
. 
. ********************************************
. ** Create dummy indicators for each Prior category (to use as control)
. capture tab surveycb33, gen(p)   // overall prior -- will include control that also has indicator for don't knows
{txt}
{com}. label variable p1 "Prior --- Much better"
{txt}
{com}. label variable p2 "Prior --- A little better"
{txt}
{com}. label variable p3 "Prior --- A little worse"
{txt}
{com}. label variable p4 "Prior --- Much worse"
{txt}
{com}. label variable p5 "Prior --- Do not know"
{txt}
{com}. 
. ****************************************************
. ** ***** Measure of of prior vote for incumbent (partisanship) 
. 
. ** Merge in information about the incumbent's political party
. tempfile temp2
{txt}
{com}. save `temp2', replace
{txt}(note: file C:\Users\JGOTTL~1\AppData\Local\Temp\ST_01000002.tmp not found)
file C:\Users\JGOTTL~1\AppData\Local\Temp\ST_01000002.tmp saved

{com}. 
. insheet using "communes.csv", names clear
{txt}(7 vars, 30 obs)

{com}. rename commune_key commune
{res}{txt}
{com}. rename party incumbent_party2011
{res}{txt}
{com}. 
. sort commune
{txt}
{com}. 
. merge 1:m commune  using `temp2'
{res}{txt}{p 0 7 2}
(note: variable
symbol was 
str25, now str27 to accommodate using data's values)
{p_end}
(label condition_numeric already defined)
(label vid already defined)
(label cid already defined)
(label iid already defined)
(label language_video already defined)
(label deputy_present already defined)
(label community_center already defined)
(label clinic already defined)
(label borehole already defined)
(label mosque_church already defined)
(label school already defined)
(label consent already defined)
(label endlineeq3 already defined)
(label endlineeq4a already defined)
(label endlineeq4b already defined)
(label endlineeq5a already defined)
(label endlineeq5b already defined)
(label endlineeq6 already defined)
(label endlineeq already defined)
(label endlineeq7 already defined)
(label endlineeq8 already defined)
(label endlineeq9_control already defined)
(label endlineeq9_cservice already defined)
(label endlineeq9_legislative already defined)
(label endlineeq10_private already defined)
(label endlineeq10_public_control already defined)
(label endlineeq12 already defined)
(label endlineeq13 already defined)
(label endlineeq14 already defined)
(label endlineeq15 already defined)
(label endlineeq16 already defined)
(label endlineeq17 already defined)
(label endlineeq18 already defined)
(label endlineeq19 already defined)
(label endlineeq20 already defined)
(label endlineeq21 already defined)
(label endlineeq22 already defined)
(label endlineeq23 already defined)
(label endlineeq24 already defined)
(label endlineeq25 already defined)
(label endlineeq26 already defined)
(label endlineeq27 already defined)
(label endlineeq29 already defined)
(label endlineeq30 already defined)
(label endlineeq31 already defined)
(label endlineeq32 already defined)
(label endlineeq34 already defined)
(label endlineeq36 already defined)
(label refusetryagain already defined)
(label _merge already defined)
(label b4 already defined)
(label b45 already defined)
(label b47 already defined)
(label b48 already defined)
(label b49 already defined)
(label b50 already defined)
(label surveycb61 already defined)
(label surveycb60 already defined)
(label surveycb57 already defined)
(label surveycb54 already defined)
(label surveycb44 already defined)
(label surveycb43 already defined)
(label surveycb42 already defined)
(label surveycb41 already defined)
(label surveycb40f already defined)
(label surveycb40e already defined)
(label surveycb40d already defined)
(label surveycb40c already defined)
(label surveycb40b already defined)
(label surveycb40a already defined)
(label surveycb39e already defined)
(label surveycb39c already defined)
(label surveycb39b already defined)
(label surveycb39a already defined)
(label surveycb38 already defined)
(label surveycb38a already defined)
(label surveycb37_legislative already defined)
(label surveycb37_cservice already defined)
(label surveycb37_control already defined)
(label surveycb36 already defined)
(label surveycb35 already defined)
(label surveycb34 already defined)
(label surveycb33 already defined)
(label surveycb32 already defined)
(label surveycb31 already defined)
(label surveycb30 already defined)
(label surveycb29 already defined)
(label surveycb28 already defined)
(label surveycb27 already defined)
(label surveycb26 already defined)
(label surveycb25 already defined)
(label surveycb24 already defined)
(label surveycb23 already defined)
(label surveycb22 already defined)
(label surveycb21 already defined)
(label surveycb20_legislative already defined)
(label surveycb20_cservice already defined)
(label surveycb20_control already defined)
(label surveycb18 already defined)
(label surveycb17 already defined)
(label surveycb14 already defined)
(label surveycb13 already defined)
(label surveycb12e already defined)
(label surveycb12d already defined)
(label surveycb12c already defined)
(label surveycb12b already defined)
(label surveycb12a already defined)
(label surveycb10b already defined)
(label surveycb10 already defined)
(label surveycb8 already defined)
(label surveycb7b already defined)
(label surveycb7 already defined)
(label surveycb4 already defined)
(label surveypconsentb3c already defined)
(label surveypconsentconsent already defined)
(label typet4 already defined)
(label typet3 already defined)
(label enumber already defined)
(label en9 already defined)
(label en4 already defined)
(label en3 already defined)

{col 5}Result{col 38}# of obs.
{col 5}{hline 41}
{col 5}not matched{col 30}{res}               0
{txt}{col 5}matched{col 30}{res}          12,526{txt}  (_merge==3)
{col 5}{hline 41}

{com}. 
. tab incumbent_party2011

{txt}incumbent_p {c |}
   arty2011 {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
        AFU {c |}{res}        736        5.88        5.88
{txt}       FCBE {c |}{res}      5,960       47.58       53.46
{txt}     FE UPR {c |}{res}        836        6.67       60.13
{txt}        G13 {c |}{res}      1,476       11.78       71.91
{txt}         UN {c |}{res}      3,518       28.09      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. tab surveycb19

    {txt}Pour quel {c |}
        parti {c |}
    avez-vous {c |}
        voté? {c |}      Freq.     Percent        Cum.
{hline 14}{c +}{hline 35}
            9 {c |}{res}        148        3.07        3.07
{txt}           99 {c |}{res}        540       11.20       14.27
{txt}          AFU {c |}{res}          3        0.06       14.33
{txt}AmanaAlliance {c |}{res}         19        0.39       14.72
{txt}       Cauris {c |}{res}         55        1.14       15.86
{txt}         FCBE {c |}{res}      3,037       62.98       78.85
{txt}          G13 {c |}{res}        360        7.47       86.31
{txt}           UB {c |}{res}          5        0.10       86.42
{txt}           UN {c |}{res}        595       12.34       98.76
{txt}          UPR {c |}{res}         60        1.24      100.00
{txt}{hline 14}{c +}{hline 35}
        Total {c |}{res}      4,822      100.00
{txt}
{com}. 
. generate votedincumbent2011=0 if surveycb18==1
{txt}(7,687 missing values generated)

{com}. replace votedincumbent2011=1 if surveycb19=="FCBE" & incumbent_party=="FCBE"
{txt}(1,752 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="Cauris" & incumbent_party=="FCBE"
{txt}(44 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="UN" & incumbent_party=="UN"
{txt}(487 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="G13" & incumbent_party=="G13"
{txt}(240 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="AFU" & incumbent_party=="AFU"
{txt}(0 real changes made)

{com}. replace votedincumbent2011=1 if surveycb19=="UPR" & incumbent_party=="FE UPR"
{txt}(13 real changes made)

{com}. 
. label var votedincumbent2011 "2011 Incumbent Vote"
{txt}
{com}. 
.         
. *****************************************
. ** Other individual level vars for balance, etc
. 
. recode surveycb4 (2=1) (1=0), gen(female)
{txt}(6128 differences between surveycb4 and female)

{com}. 
. gen age=surveycb5 if surveycb5>18 & surveycb5<100
{txt}(6,547 missing values generated)

{com}. 
. encode surveycb9, gen(ethnicity_numeric)
{txt}
{com}. 
. encode surveycb6, gen(language)
{txt}
{com}. 
. gen educyears=surveycb7
{txt}(6,469 missing values generated)

{com}. 
. 
. gen conseil_chef = surveycb12a
{txt}(6,410 missing values generated)

{com}.         label variable conseil_chef "Member of chief's council"
{txt}
{com}. gen professional =  surveycb12b
{txt}(6,419 missing values generated)

{com}.         label variable professional "Member of professional assoc."
{txt}
{com}. gen jeunes= surveycb12c
{txt}(6,439 missing values generated)

{com}.         label variable jeunes "Member of youth assoc."
{txt}
{com}. gen womens_group= surveycb12d
{txt}(6,440 missing values generated)

{com}.         label variable womens_gr "Member of women's assoc."
{txt}
{com}. gen politique= surveycb12e
{txt}(6,425 missing values generated)

{com}.         label variable politique "Member of political assoc."
{txt}
{com}.         
. tab surveycb13, gen(information_source)

        {txt}Quelle source {c |}
       d’informations {c |}
utilisez-vous le plus {c |}
     fréquemment pour {c |}
            rester au {c |}      Freq.     Percent        Cum.
{hline 22}{c +}{hline 35}
                Radio {c |}{res}      3,908       63.86       63.86
{txt}             Journaux {c |}{res}         32        0.52       64.38
{txt}           Télévision {c |}{res}        556        9.08       73.46
{txt}Amis ou connaissances {c |}{res}      1,128       18.43       91.90
{txt}               Autre: {c |}{res}         49        0.80       92.70
{txt}               Aucune {c |}{res}        447        7.30      100.00
{txt}{hline 22}{c +}{hline 35}
                Total {c |}{res}      6,120      100.00
{txt}
{com}.         label variable information_source1 "Information from radio"
{txt}
{com}.         label variable information_source2 "Information from newspaper"
{txt}
{com}.         label variable information_source3 "Information from television"
{txt}
{com}.         label variable information_source4 "Information from friends"
{txt}
{com}. 
. tab surveycb14, gen(discuss)

 {txt}Quand vous {c |}
 êtes entre {c |}
 amis ou en {c |}
   famille, {c |}
 combien de {c |}
fois parlez {c |}
    vous de {c |}
     choses {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     Jamais {c |}{res}      2,342       38.27       38.27
{txt}    Parfois {c |}{res}      3,014       49.25       87.52
{txt}    Souvent {c |}{res}        764       12.48      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      6,120      100.00
{txt}
{com}.         label variable discuss1 "Never discuss politics"
{txt}
{com}.         label variable discuss2 "Sometimes discuss poltics"
{txt}
{com}.         label variable discuss3 "Often discuss politics"
{txt}
{com}. 
. recode surveycb21 (3 4 = 1) (1 2 = 0), gen(secret_ballot)
{txt}(5962 differences between surveycb21 and secret_ballot)

{com}.          tab secret surveycb21

 {txt}RECODE of {c |}
surveycb21 {c |}
   (Est-il {c |}
  probable {c |}
   que les {c |}
 hommes et {c |}
 femmes de {c |} Est-il probable que les hommes et femmes de
   pouvoir {c |}    pouvoir puissent savoir comment vous
    puisse {c |} Pas du to  Pas vraim  Assez pro  Très prob {c |}     Total
{hline 11}{c +}{hline 44}{c +}{hline 10}
         0 {c |}{res}     2,978      1,834          0          0 {txt}{c |}{res}     4,812 
{txt}         1 {c |}{res}         0          0        682        468 {txt}{c |}{res}     1,150 
{txt}{hline 11}{c +}{hline 44}{c +}{hline 10}
     Total {c |}{res}     2,978      1,834        682        468 {txt}{c |}{res}     5,962 

{txt}
{com}.          label variable secret "Ballot secrecy can be violated"
{txt}
{com}. 
. gen know_village_vote= surveycb42
{txt}(6,475 missing values generated)

{com}.         label variable know_village_ "Parties know how the village voted"
{txt}
{com}. 
. gen consequences =surveycb43
{txt}(9,065 missing values generated)

{com}.         label variable consequences "Consequences if village does not support a party"
{txt}
{com}. 
. gen help= surveycb27
{txt}(6,435 missing values generated)

{com}.         label variable help "Received Help"
{txt}
{com}. 
. recode  surveycb33 (1 2 = 1) (3 4 =0) (99 = .), gen(overall_prior)
{txt}(5642 differences between surveycb33 and overall_prior)

{com}.         label variable overall_prio "Positive Overall Prior"
{txt}
{com}. 
. recode  surveycb35 (1 2 = 1) (3 4 =0) (99 = .), gen(effort_prior)
{txt}(5757 differences between surveycb35 and effort_prior)

{com}.         label variable effort_prio "Positive prior about effort of incumbent"
{txt}
{com}.         
. recode  surveycb36 (1 2 = 1) (3 4 =0) (99 = .), gen(corruption_prior)
{txt}(4122 differences between surveycb36 and corruption_prior)

{com}.         label variable corruption_prio "Would be surprised to hear about incumbent corruption"
{txt}
{com}. 
. 
. 
. label variable urban "Urban"
{txt}
{com}. label variable margin "Vote margin (top 2 parties) in previous election"
{txt}
{com}. 
. 
. label variable assembly_index  "Incumbent score on plenary index"
{txt}
{com}. label variable committee_index  "Incumbent score on committee index"
{txt}
{com}. label variable main_index "Incumbent score overall index"
{txt}
{com}. label variable female "Female"
{txt}
{com}. 
. label variable educyears "Years of education"
{txt}
{com}. label variable age "Age"
{txt}
{com}. 
. label var treatment "Treatment"
{txt}
{com}. ******************
.         ************ Access to electricity ************
. 
. tab surveycb60, missing

   {txt}Quelle est la source {c |}
   principale d’énergie {c |}
dans cette concession ? {c |}      Freq.     Percent        Cum.
{hline 24}{c +}{hline 35}
Courant fourni par SBEE {c |}{res}      1,610       12.85       12.85
{txt}     Groupe électrogène {c |}{res}        309        2.47       15.32
{txt}         Lampe kérosène {c |}{res}      1,631       13.02       28.34
{txt}         Torches à pile {c |}{res}      1,971       15.74       44.08
{txt}                Bougies {c |}{res}         32        0.26       44.33
{txt}        Energie solaire {c |}{res}         60        0.48       44.81
{txt}                Autre : {c |}{res}        143        1.14       45.95
{txt}                 Aucune {c |}{res}        354        2.83       48.78
{txt}                      . {c |}{res}      6,416       51.22      100.00
{txt}{hline 24}{c +}{hline 35}
                  Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. gen electricity_type=surveycb60
{txt}(6,416 missing values generated)

{com}. replace electricity=1 if electricity_type==1 |electricity_type==2|electricity_type==6
{txt}(369 real changes made)

{com}. replace electricity=0 if electricity_type==3 | electricity_type==4 | electricity_type==5| electricity_type==7| electricity_type==8
{txt}(4,131 real changes made)

{com}. 
. tab electricity

{txt}electricity {c |}
      _type {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      4,131       67.61       67.61
{txt}          1 {c |}{res}      1,979       32.39      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      6,110      100.00
{txt}
{com}. 
. ************ Material of House ************
. 
. tab surveycb58, missing

    {txt}De quel matériel était faite la {c |}
   maison dans laquelle l’entretien {c |}
                          s’est con {c |}      Freq.     Percent        Cum.
{hline 36}{c +}{hline 35}
                                    {c |}{res}      6,417       51.23       51.23
{txt}                                 15 {c |}{res}          1        0.01       51.24
{txt}                    A coté d'un mur {c |}{res}          1        0.01       51.25
{txt}                  A côté  d'un  mur {c |}{res}         25        0.20       51.44
{txt}             A côté  d'un  paillote {c |}{res}          1        0.01       51.45
{txt}               A côté  d'un apattam {c |}{res}          2        0.02       51.47
{txt}                   A côté  d'un mur {c |}{res}          6        0.05       51.52
{txt}                   A côté d'un  mur {c |}{res}          2        0.02       51.53
{txt}                    A côté d'un mur {c |}{res}          2        0.02       51.55
{txt}                             Apatam {c |}{res}         10        0.08       51.63
{txt}                            Apattam {c |}{res}         17        0.14       51.76
{txt}                            Appatam {c |}{res}          1        0.01       51.77
{txt}                              Argil {c |}{res}          1        0.01       51.78
{txt}                             Argile {c |}{res}         18        0.14       51.92
{txt}                    Avec  du ciment {c |}{res}          1        0.01       51.93
{txt}                             Bambou {c |}{res}         64        0.51       52.44
{txt}                              Bamko {c |}{res}          1        0.01       52.45
{txt}                              Banci {c |}{res}          1        0.01       52.46
{txt}                              Banco {c |}{res}        479        3.82       56.28
{txt}                              Banka {c |}{res}          1        0.01       56.29
{txt}                              Banko {c |}{res}        210        1.68       57.97
{txt}                              Banvo {c |}{res}          1        0.01       57.98
{txt}                     Barre de terre {c |}{res}          1        0.01       57.98
{txt}                              Bique {c |}{res}          1        0.01       57.99
{txt}                               Bloc {c |}{res}          6        0.05       58.04
{txt}                              Block {c |}{res}         14        0.11       58.15
{txt}                             Bloque {c |}{res}         56        0.45       58.60
{txt}                               Bois {c |}{res}         17        0.14       58.73
{txt}                               Boue {c |}{res}          5        0.04       58.77
{txt}                             Brique {c |}{res}        360        2.87       61.65
{txt}                   Brique  de terre {c |}{res}          2        0.02       61.66
{txt}                  Brique  en  banco {c |}{res}          1        0.01       61.67
{txt}                   Brique  en banco {c |}{res}          2        0.02       61.69
{txt}                    Brique  en dure {c |}{res}          1        0.01       61.70
{txt}                       Brique banco {c |}{res}          1        0.01       61.70
{txt}                   Brique de ciment {c |}{res}          7        0.06       61.76
{txt}                    Brique de terre {c |}{res}        156        1.25       63.00
{txt}              Brique de terre battu {c |}{res}          1        0.01       63.01
{txt}             Brique de terre battue {c |}{res}          2        0.02       63.03
{txt}      Brique de terre, terre battue {c |}{res}          2        0.02       63.04
{txt}       Brique de terre,terre battue {c |}{res}          1        0.01       63.05
{txt}                   Brique en  banco {c |}{res}          2        0.02       63.07
{txt}                    Brique en banco {c |}{res}         18        0.14       63.21
{txt}Brique en banco et en terre  battue {c |}{res}          1        0.01       63.22
{txt}             Brique en terre battue {c |}{res}          1        0.01       63.23
{txt}                    Brique et terre {c |}{res}          1        0.01       63.24
{txt}             Brique et terre battue {c |}{res}          1        0.01       63.24
{txt}                Brique terre battue {c |}{res}          2        0.02       63.26
{txt}                            Briques {c |}{res}        546        4.36       67.62
{txt}        Briques  de terre en battue {c |}{res}          2        0.02       67.64
{txt}           Briques  en terre battue {c |}{res}          1        0.01       67.64
{txt}             Briques  et terre batu {c |}{res}          1        0.01       67.65
{txt}                Briques  stabilisée {c |}{res}          1        0.01       67.66
{txt}                  Briques de ciment {c |}{res}         20        0.16       67.82
{txt}           Briques de terre  battue {c |}{res}          1        0.01       67.83
{txt}  Briques de terre  battue + ciment {c |}{res}          1        0.01       67.83
{txt}             Briques de terre battu {c |}{res}          2        0.02       67.85
{txt}            Briques de terre battue {c |}{res}         39        0.31       68.16
{txt}   Briques de terre battue + ciment {c |}{res}         15        0.12       68.28
{txt}    Briques de terre battue +ciment {c |}{res}          2        0.02       68.30
{txt}  Briques dee terre battue + ciment {c |}{res}          1        0.01       68.31
{txt}                Briques des  ciment {c |}{res}          1        0.01       68.31
{txt}   Briques dr terre  battue +ciment {c |}{res}          1        0.01       68.32
{txt}                      Briques dures {c |}{res}          1        0.01       68.33
{txt}                  Briques en ciment {c |}{res}          1        0.01       68.34
{txt}           Briques en terre  battue {c |}{res}          1        0.01       68.35
{txt}            Briques en terre battue {c |}{res}          7        0.06       68.40
{txt}              Briques en terre batu {c |}{res}          1        0.01       68.41
{txt}           Briques et terre- battue {c |}{res}          1        0.01       68.42
{txt}                      Briques rouge {c |}{res}          2        0.02       68.43
{txt}               Briques terre battue {c |}{res}          1        0.01       68.44
{txt}      Briques terre battue + ciment {c |}{res}          2        0.02       68.46
{txt}       Briques terre battue +ciment {c |}{res}          1        0.01       68.47
{txt}                              Brque {c |}{res}          1        0.01       68.47
{txt}                              Bsnco {c |}{res}          3        0.02       68.50
{txt}                             Chaume {c |}{res}          2        0.02       68.51
{txt}                             Ciment {c |}{res}        158        1.26       69.77
{txt}                               Clai {c |}{res}          1        0.01       69.78
{txt}                       Dans la cour {c |}{res}          2        0.02       69.80
{txt}          Dans la cour de la maison {c |}{res}          2        0.02       69.81
{txt}          Dans la cour de sa maison {c |}{res}          1        0.01       69.82
{txt}                       Dans sa cour {c |}{res}          1        0.01       69.83
{txt}         Dans une clôture en brique {c |}{res}          1        0.01       69.84
{txt}                         Demi banko {c |}{res}          1        0.01       69.85
{txt}                        Demi-Bloque {c |}{res}          1        0.01       69.85
{txt}                                Dur {c |}{res}          8        0.06       69.92
{txt}                               Dure {c |}{res}         23        0.18       70.10
{txt}                          En bambou {c |}{res}          3        0.02       70.13
{txt}                           En banco {c |}{res}          7        0.06       70.18
{txt}                           En banko {c |}{res}          1        0.01       70.19
{txt}                   En briques dures {c |}{res}          1        0.01       70.20
{txt}                            En clai {c |}{res}          6        0.05       70.25
{txt}                           En clair {c |}{res}          3        0.02       70.27
{txt}                          En claire {c |}{res}          4        0.03       70.30
{txt}                             En dur {c |}{res}         11        0.09       70.39
{txt}                            En dure {c |}{res}         10        0.08       70.47
{txt}                     En terre battu {c |}{res}          1        0.01       70.48
{txt}                    En terre battue {c |}{res}          1        0.01       70.49
{txt}                              Endur {c |}{res}          1        0.01       70.49
{txt}                             Endure {c |}{res}          1        0.01       70.50
{txt}                   Feuille de palme {c |}{res}          1        0.01       70.51
{txt}                 Feuille de palmier {c |}{res}          1        0.01       70.52
{txt}                    Français -peulh {c |}{res}          1        0.01       70.53
{txt}                           Gbomitan {c |}{res}          2        0.02       70.54
{txt}                             Hangar {c |}{res}          2        0.02       70.56
{txt}               MATERIAUX Definitifs {c |}{res}          1        0.01       70.57
{txt}              Maison a terre battue {c |}{res}          1        0.01       70.57
{txt}                   Maison en brique {c |}{res}          4        0.03       70.61
{txt}               Matériaux  definitif {c |}{res}          2        0.02       70.62
{txt}              Matériaux  definitifs {c |}{res}          1        0.01       70.63
{txt}                Matériaux  defitifs {c |}{res}          1        0.01       70.64
{txt}               Matériaux  définitif {c |}{res}          6        0.05       70.68
{txt}              Matériaux  définitifs {c |}{res}          6        0.05       70.73
{txt}                  Matériaux  locaux {c |}{res}         16        0.13       70.86
{txt}                Matériaux  précaire {c |}{res}         93        0.74       71.60
{txt}               Matériaux  précaires {c |}{res}          4        0.03       71.63
{txt}               Matériaux definitifs {c |}{res}          2        0.02       71.65
{txt}                Matériaux définitif {c |}{res}          3        0.02       71.67
{txt}               Matériaux définitifs {c |}{res}         35        0.28       71.95
{txt}                   Matériaux locaux {c |}{res}         43        0.34       72.30
{txt}                 Matériaux primaire {c |}{res}          1        0.01       72.31
{txt}               Matériaux pré caires {c |}{res}          1        0.01       72.31
{txt}                 Matériaux précaire {c |}{res}         20        0.16       72.47
{txt}                Matériaux précaires {c |}{res}        109        0.87       73.34
{txt}   Mélange de ciment et terre battu {c |}{res}          1        0.01       73.35
{txt}                              Pagne {c |}{res}          1        0.01       73.36
{txt}                         Paillasson {c |}{res}          2        0.02       73.38
{txt}                             Paille {c |}{res}         10        0.08       73.46
{txt}                            Pailles {c |}{res}          1        0.01       73.46
{txt}                          Plein air {c |}{res}          4        0.03       73.50
{txt}                           Semi dur {c |}{res}          6        0.05       73.54
{txt}                           Semi-dur {c |}{res}          1        0.01       73.55
{txt}                      Sous  apattam {c |}{res}         13        0.10       73.65
{txt}                      Sous  appatam {c |}{res}          2        0.02       73.67
{txt}                        Sous  arbre {c |}{res}          2        0.02       73.69
{txt}                     Sous  paillote {c |}{res}          1        0.01       73.69
{txt}                    Sous  un  arbre {c |}{res}         10        0.08       73.77
{txt}                     Sous  un arbre {c |}{res}          6        0.05       73.82
{txt}                        Sous apatam {c |}{res}          1        0.01       73.83
{txt}                       Sous apattam {c |}{res}          7        0.06       73.89
{txt}                       Sous appatam {c |}{res}          2        0.02       73.90
{txt}                         Sous arbre {c |}{res}         15        0.12       74.02
{txt}                    Sous la veranda {c |}{res}          1        0.01       74.03
{txt}                     Sous paillotte {c |}{res}          1        0.01       74.04
{txt}                     Sous palmerais {c |}{res}          1        0.01       74.05
{txt}                       Sous palmier {c |}{res}          1        0.01       74.05
{txt}                     Sous un  arbre {c |}{res}          1        0.01       74.06
{txt}                    Sous un appatam {c |}{res}          1        0.01       74.07
{txt}                      Sous un arbre {c |}{res}          6        0.05       74.12
{txt}                     Sous un hangar {c |}{res}          3        0.02       74.14
{txt}                  Sous un paillotte {c |}{res}          1        0.01       74.15
{txt}                                  T {c |}{res}          2        0.02       74.17
{txt}                                 Te {c |}{res}          2        0.02       74.18
{txt}                         Tere battu {c |}{res}          4        0.03       74.21
{txt}                        Tere battue {c |}{res}          1        0.01       74.22
{txt}                          Tere batu {c |}{res}          1        0.01       74.23
{txt}                          Terr batu {c |}{res}          1        0.01       74.24
{txt}                              Terre {c |}{res}        491        3.92       78.16
{txt}                       Terre  battu {c |}{res}         53        0.42       78.58
{txt}                      Terre  battue {c |}{res}         59        0.47       79.05
{txt}                      Terre  battur {c |}{res}          1        0.01       79.06
{txt}                     Terre  battute {c |}{res}          1        0.01       79.07
{txt}                        Terre  batu {c |}{res}          1        0.01       79.08
{txt}                       Terre  batue {c |}{res}          2        0.02       79.09
{txt}                      Terre  brique {c |}{res}          2        0.02       79.11
{txt}                     Terre  briques {c |}{res}          2        0.02       79.12
{txt}                       Terre  bât u {c |}{res}          1        0.01       79.13
{txt}                        Terre  bâti {c |}{res}          1        0.01       79.14
{txt}                       Terre  bâtie {c |}{res}          3        0.02       79.16
{txt}                        Terre  bâtu {c |}{res}          3        0.02       79.19
{txt}                    Terre  de barre {c |}{res}         19        0.15       79.34
{txt}                      Terre  pétrie {c |}{res}          2        0.02       79.35
{txt}                       Terre  rouge {c |}{res}         13        0.10       79.46
{txt}                      Terre -battue {c |}{res}          2        0.02       79.47
{txt}                     Terre De barre {c |}{res}          1        0.01       79.48
{txt}                    Terre argileuse {c |}{res}          2        0.02       79.50
{txt}                        Terre battu {c |}{res}        670        5.35       84.85
{txt}                 Terre battu+ciment {c |}{res}          1        0.01       84.86
{txt}                       Terre battue {c |}{res}      1,036        8.27       93.13
{txt}      Terre battue ,brique de terre {c |}{res}          2        0.02       93.14
{txt}       Terre battue,brique de terre {c |}{res}          1        0.01       93.15
{txt}                      Terre battues {c |}{res}          3        0.02       93.17
{txt}                         Terre batu {c |}{res}          9        0.07       93.25
{txt}                        Terre batue {c |}{res}          1        0.01       93.25
{txt}                       Terre batues {c |}{res}          2        0.02       93.27
{txt}                         Terre bâti {c |}{res}          1        0.01       93.28
{txt}                        Terre bâtie {c |}{res}        176        1.41       94.68
{txt}                       Terre bâttue {c |}{res}          1        0.01       94.69
{txt}                         Terre bâtu {c |}{res}          3        0.02       94.71
{txt}                     Terre de barre {c |}{res}         81        0.65       95.36
{txt}                       Terre de bas {c |}{res}         16        0.13       95.49
{txt}                   Terre et briques {c |}{res}          1        0.01       95.50
{txt}                        Terre pétri {c |}{res}        130        1.04       96.54
{txt}                       Terre pétrie {c |}{res}        162        1.29       97.83
{txt}                        Terre rouge {c |}{res}        139        1.11       98.94
{txt}                   Terre stabilisée {c |}{res}          2        0.02       98.95
{txt}                        Terre terre {c |}{res}          1        0.01       98.96
{txt}                      Terre à barre {c |}{res}          1        0.01       98.97
{txt}                        Terre,battu {c |}{res}          1        0.01       98.98
{txt}                       Terre- battu {c |}{res}          2        0.02       98.99
{txt}                      Terre- battue {c |}{res}         55        0.44       99.43
{txt}                       Terre-battue {c |}{res}         10        0.08       99.51
{txt}            Terre-battue  et brique {c |}{res}          1        0.01       99.52
{txt}                       Terre-pétrie {c |}{res}          2        0.02       99.54
{txt}                        Terrebattue {c |}{res}          1        0.01       99.54
{txt}                        Terrebuttue {c |}{res}          1        0.01       99.55
{txt}                             Terres {c |}{res}         23        0.18       99.74
{txt}                     Terres  batues {c |}{res}          2        0.02       99.75
{txt}                    Terres  briques {c |}{res}          1        0.01       99.76
{txt}                  Terres  et brique {c |}{res}          1        0.01       99.77
{txt}                      Terres batues {c |}{res}         13        0.10       99.87
{txt}                       Terrr battue {c |}{res}          1        0.01       99.88
{txt}                              Terry {c |}{res}          1        0.01       99.89
{txt}                       Terré battue {c |}{res}          1        0.01       99.90
{txt}                       Terte battue {c |}{res}          1        0.01       99.90
{txt}                      Tertes batues {c |}{res}          1        0.01       99.91
{txt}                               Toil {c |}{res}          1        0.01       99.92
{txt}                               Tole {c |}{res}          1        0.01       99.93
{txt}                              Têrre {c |}{res}          1        0.01       99.94
{txt}                               Tôle {c |}{res}          7        0.06       99.99
{txt}                              battu {c |}{res}          1        0.01      100.00
{txt}{hline 36}{c +}{hline 35}
                              Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. gen materialh=surveycb58
{txt}(6,417 missing values generated)

{com}. gen house=.
{txt}(12,526 missing values generated)

{com}. 
. replace house=1 if materialh=="A cot√© d'un mur" | materialh=="A c√¥t√©  d'un  mur"  | materialh=="A c√¥t√©  d'un mur" | materialh=="A c√¥t√© d'un  mur" | materialh=="A c√¥t√© d'un mur"
{txt}(0 real changes made)

{com}. 
. replace house=2 if materialh=="A c√¥t√©  d'un apattam" | materialh=="Apatam"  | materialh=="Apattam" | materialh=="Appatam" | materialh=="Sous un appatam" | materialh=="Sous  apattam" ///
> | materialh=="Sous  appatam" | materialh=="Sous apatam" | materialh=="Sous apattam" | materialh=="Sous appatam"
{txt}(54 real changes made)

{com}. 
. replace house=3 if materialh=="Mat√©riaux  pr√©caire" | materialh=="Mat√©riaux  pr√©caires" | materialh=="Mat√©riaux primaire" | materialh=="Mat√©riaux pr√© caires" | materialh=="Mat√©riaux pr√©caire" | materialh=="Mat√©riaux pr√©caires" 
{txt}(0 real changes made)

{com}. 
. replace house=4 if materialh=="Avec  du ciment" | materialh=="Ciment" | materialh=="Briques en ciment" | materialh=="Briques des  ciment" | materialh=="Briques de ciment" | materialh=="Brique de ciment"  
{txt}(188 real changes made)

{com}. 
. replace house=5 if materialh=="Bambou" | materialh=="En bambou"
{txt}(67 real changes made)

{com}. 
. replace house=6 if materialh=="Argil" | materialh=="Argile" | materialh=="Bamko" | materialh=="Boue" | materialh=="Banci" | materialh=="Banco" | materialh=="Banka"|materialh=="Banko"| materialh=="Banvo" ///
> |materialh=="Brique en  banco"| materialh=="Brique en banco" | materialh=="Barre de terre" | materialh=="Brique  de terre" | materialh=="Brique de terre" ///
> | materialh=="Brique de terre battue" | materialh=="Brique de terre battu"| materialh=="Brique de terre, terre battue" | materialh=="Brique de terre,terre battue" ///
> | materialh=="Brique" | materialh=="Bique" | materialh=="Brique en banco et en terre  battue " | materialh=="Brique en terre battue" | materialh=="Brique et terre" ///
> | materialh=="Brique et terre battue"| materialh=="Brique terre battue" | materialh=="Briques" | materialh=="Briques  de terre en battue" | materialh=="Briques  en terre battue" ///
> | materialh=="Briques  et terre batu" | materialh=="Briques  stabilis√©e" | materialh=="Briques de terre  battue" | materialh=="Briques de terre battu" | materialh=="Briques de terre battue" ///
> | materialh=="Briques en terre  battue"| materialh=="Briques en terre battue" | materialh=="Briques en terre batu" | materialh=="Briques et terre- battue" | materialh=="Briques rouge" ///
> | materialh=="Briques terre battue" | materialh=="Brque" | materialh=="Bsnco" | materialh=="Clai" | materialh=="Dans une cl√¥ture en brique" | materialh=="Demi banko" | materialh=="En banco" ///
> | materialh=="En banko" | materialh=="En clai" | materialh=="En clair" | materialh=="En claire" | materialh=="En terre battu" | materialh=="En terre battue" | materialh=="Maison a terre battue" ///
> | materialh=="Tere battu" | materialh=="Tere battue" | materialh=="Tere batu" | materialh=="Terr batu" | materialh=="Terre" | materialh=="Terre  battu" | materialh=="Terre  battue" ///
> | materialh=="Terre  battur" | materialh=="Terre  battute" | materialh=="Terre  batu" | materialh=="Terre  batue" | materialh=="Terre  brique" | materialh=="Terre  briques" ///
> | materialh=="Terre  b√¢t u" | materialh=="Terre  b√¢ti" | materialh=="Terre  b√¢tie"| materialh=="Terre  b√¢tu"| materialh=="Terre  de barre" | materialh=="Terre  p√©trie" ///
> | materialh=="Terre  rouge" | materialh=="Terre -battue" | materialh=="Terre De barre" | materialh=="Terre argileuse" | materialh=="Terre battu" | materialh=="Terre battue" ///
> | materialh=="Terre battue ,brique de terre" | materialh=="Terre battue,brique de terre" | materialh=="Terre battues" | materialh=="Terre batu" | materialh=="Terre batue" ///
> | materialh=="Terre batues" | materialh=="Terre b√¢ti" | materialh=="Terre b√¢tie" | materialh=="Terre b√¢ttue" | materialh=="Terre b√¢tu" | materialh=="Terre de barre" ///
> | materialh=="Terre de bas" | materialh=="Terre et briques" | materialh=="Terre p√©tri" | materialh=="Terre p√©trie" | materialh=="Terre rouge" | materialh=="Terre stabilis√©e" ///
> | materialh=="Terre terre" | materialh=="Terre √† barre" | materialh=="Terre,battu" | materialh=="Terre- battu" | materialh=="Terre- battue" | materialh=="Terre-battue" ///
> | materialh=="Terre-battue  et brique" | materialh=="Terre-p√©trie" | materialh=="Terrebattue" | materialh=="Terrebuttue" | materialh=="Terres" | materialh=="Terres  batues" ///
> | materialh=="Terres  briques" | materialh=="Terres  et brique" | materialh=="Terres batues" | materialh=="Terrr battue" | materialh=="Terry" | materialh=="Terr√© battue" ///
> | materialh=="Terte battue" | materialh=="Tertes batues" | materialh=="T√™rre" | materialh=="battu" 
{txt}(4,637 real changes made)

{com}. 
. replace house=7 if materialh=="Briques de terre  battue + ciment" | materialh=="Briques de terre battue + ciment" | materialh=="Briques de terre battue +ciment" ///
> | materialh=="Briques dee terre battue + ciment" | materialh=="Briques dr terre  battue +ciment" | materialh=="Briques dr terre  battue +ciment" | materialh=="Briques terre battue + ciment" ///
> | materialh=="Briques terre battue +ciment" | materialh=="M√©lange de ciment et terre battu" | materialh=="Terre battu+ciment" 
{txt}(24 real changes made)

{com}. 
. replace house=8 if materialh=="Bois" 
{txt}(17 real changes made)

{com}. 
. replace house=9 if materialh=="Toile" | materialh=="Tole"
{txt}(1 real change made)

{com}. 
. replace house=10 if materialh=="Dur" | materialh=="Dure" | materialh=="En briques dures" | materialh=="En dur" | materialh=="En dure" | materialh=="Endur" | materialh=="Endure" 
{txt}(55 real changes made)

{com}. 
. replace house=11 if materialh=="Pagne" 
{txt}(1 real change made)

{com}. 
. replace house=12 if materialh=="MATERIAUX Definitifs" | materialh=="Mat√©riaux  definitif" | materialh=="Mat√©riaux  definitifs" | materialh=="Mat√©riaux  defitifs" | materialh=="Mat√©riaux  d√©finitif" ///
>  | materialh=="Mat√©riaux  d√©finitifs" |  materialh=="Mat√©riaux definitifs" | materialh=="Mat√©riaux d√©finitif" | materialh=="Mat√©riaux d√©finitifs"
{txt}(1 real change made)

{com}. 
. replace house=13 if materialh=="Paillasson" | materialh=="Paille" | materialh=="Pailles" | materialh=="Chaume"  | materialh=="Sous un paillotte" | materialh=="Sous paillotte" 
{txt}(17 real changes made)

{com}. 
. replace house=14 if materialh=="Mat√©riaux  pr√©caire" | materialh=="Mat√©riaux  pr√©caires" | materialh=="Mat√©riaux primaire" | materialh=="Mat√©riaux pr√© caires" | materialh=="Mat√©riaux pr√©caire" | materialh=="Mat√©riaux pr√©caires" 
{txt}(0 real changes made)

{com}. 
. replace house=15 if materialh=="Mat√©riaux  locaux" | materialh=="Mat√©riaux locaux" 
{txt}(0 real changes made)

{com}. 
. tab house, missing

      {txt}house {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          2 {c |}{res}         54        0.43        0.43
{txt}          4 {c |}{res}        188        1.50        1.93
{txt}          5 {c |}{res}         67        0.53        2.47
{txt}          6 {c |}{res}      4,637       37.02       39.49
{txt}          7 {c |}{res}         24        0.19       39.68
{txt}          8 {c |}{res}         17        0.14       39.81
{txt}          9 {c |}{res}          1        0.01       39.82
{txt}         10 {c |}{res}         55        0.44       40.26
{txt}         11 {c |}{res}          1        0.01       40.27
{txt}         12 {c |}{res}          1        0.01       40.28
{txt}         13 {c |}{res}         17        0.14       40.41
{txt}          . {c |}{res}      7,464       59.59      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. 
. /*
> 1=Side wall
> 2=Apattam
> 3=Palm trees, under a tree, under a palm
> 4=Cement or Cement Bricks
> 5=Bamboo
> 6=MUD AND CLAY
> 7=mud/clay and cement
> 8=Wood
> 9=Metal Sheet
> 10=Hard material
> 11= cloth
> 12=Definitive materials
> 13=Straw
> 14=precarious materials
> 15= Local materials
> 
> */
. 
. gen house_poverty=.
{txt}(12,526 missing values generated)

{com}. 
. replace house_poverty=1 if house==2 | house==3 | house==11 | house== 13 | house==14
{txt}(72 real changes made)

{com}. 
. 
. replace house_poverty=2 if house==6 | house==5 | house==8
{txt}(4,721 real changes made)

{com}. 
. replace house_poverty=3 if house==7 | house==8 
{txt}(41 real changes made)

{com}. 
. replace house_poverty=4 if house==4 | house==10 | house==12 
{txt}(244 real changes made)

{com}. /*
> house_poverty: 1-4 (lower values indicate more poverty)
> 1- Apattam, Palm trees, under a tree, under a palm, cloth, straw, precarious materials.
> 2- Mud, Clay, Mud and Clay, Bricks, 
> 3- Mud/CLay mixed with Cement, Wood
> 4- Cement, Hard Materials, Definitive materials, Metal sheet (1 observation). 
> */
. 
. label variable house_pover "Poverty (housing material)"
{txt}
{com}. 
. ************ Material of Roof ************
. 
. gen roofmat=surveycb59
{txt}(6,535 missing values generated)

{com}. gen roof=.
{txt}(12,526 missing values generated)

{com}. 
. replace roof=1 if roofmat=="Apattam"
{txt}(1 real change made)

{com}. 
. replace roof=2 if roofmat=="Banco" | roofmat=="Banko" | roofmat=="Brigue" | roofmat=="Brique de terre" ///
> | roofmat=="Briques" | roofmat=="T" | roofmat=="Terre" | roofmat=="Terre battu" | roofmat=="Terre battue" | roofmat=="Terre p√©trie" 
{txt}(20 real changes made)

{com}. 
. replace roof=3 if roofmat=="Chaume" | roofmat=="En feuille de branche" | roofmat=="Des paille" | roofmat=="En feuille de branche" ///
> | roofmat=="En paille" | roofmat=="Feuille de paille" | roofmat=="Feuille de palme" | roofmat=="Feuille du  palme" ///
> | roofmat=="Feuilles  de branche" | roofmat=="Paill" | roofmat=="Paillasson" | roofmat=="Paille" | roofmat=="Pailles" 
{txt}(440 real changes made)

{com}. 
. replace roof=4 if roofmat=="Feuille de tole" | roofma=="Feuilles  de tole" | roofmat=="Feuilles  de toles" ///
> | roofmat=="Feuilles  de t√¥le" | roofmat=="Feuilles de toles" | roofmat=="Feuilles de toltes" ///
> | roofmat=="Feuilles, de toles" | roofmat=="Les toles" | roofmat=="Toil" | roofmat=="Toile" | roofmat=="Toke" ///
> | roofmat=="Tol" | roofmat=="Tole" | roofmat=="Tole  ondulee" | roofmat=="Tole ondulee" | roofmat=="Tole ondul√©e" ///
> | roofmat=="Toles" | roofmat=="Tolle" | roofmat=="Tolles" | roofmat=="Tolr" | roofmat=="Tol√©r√©" | roofmat=="To√Æl" 
{txt}(894 real changes made)

{com}. 
. replace roof=5 if roofmat=="Tuile" | roofmat=="Tuiles" | roofmat=="Tule" | roofmat=="Tules" | roofmat=="Tulle" ///
> | roofmat=="Turle" | roofmat=="T√¥ke" | roofmat=="T√¥le" | roofmat=="T√¥le  dalles" | roofmat=="T√¥le  et dalles" ///
> | roofmat=="T√¥le T√¥le" | roofmat=="T√¥le de" | roofmat=="T√¥le et paille" | roofmat=="T√¥le et  paille" ///
> | roofmat=="T√¥le ondulee" | roofmat=="T√¥le ondul√©e" | roofmat=="T√¥les" | roofmat=="Y T√¥le" 
{txt}(70 real changes made)

{com}. 
. replace roof=6 if roofmat=="Ciment"
{txt}(3 real changes made)

{com}. 
. replace roof=7 if roofmat=="Pagne" 
{txt}(49 real changes made)

{com}. 
. /* 
> 1=apattam
> 2= mud or clay
> 3= straw, branches, palms
> 4= metal sheet 
> 5=Tiles
> 6= cement
> 7=cloth
> */
. 
. gen roof_poverty=.
{txt}(12,526 missing values generated)

{com}. 
. replace roof_poverty=1 if roof==1 | roof==3 | roof==6 | roof==7
{txt}(493 real changes made)

{com}. 
. replace roof_poverty=2 if roof==2 | roof==4 
{txt}(914 real changes made)

{com}. 
. replace roof_poverty=3 if roof==5
{txt}(70 real changes made)

{com}. 
. replace roof_poverty=4 if roof==6
{txt}(3 real changes made)

{com}. 
. tab roof_poverty, missing

{txt}roof_povert {c |}
          y {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          1 {c |}{res}        490        3.91        3.91
{txt}          2 {c |}{res}        914        7.30       11.21
{txt}          3 {c |}{res}         70        0.56       11.77
{txt}          4 {c |}{res}          3        0.02       11.79
{txt}          . {c |}{res}     11,049       88.21      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}     12,526      100.00
{txt}
{com}. 
. ***** Create index of poverty
. 
. * Run little program for creating Anderson indices
. do genindex.do
{txt}
{com}. *ssc install center
. cap program drop _all
{txt}
{com}. program genindex
{txt}  1{com}. 
.         version 12
{txt}  2{com}.         syntax varlist [aw] , nv(string)
{txt}  3{com}.         
.         *qui {c -(}
.                 center `varlist' , pre(z_) st
{txt}  4{com}. 
.         // #1-a Mean of those zscores, 0/1 at median: M
.                 egen `nv'M = rowmean(z_*)
{txt}  5{com}.                 if "`exp'" != "" {c -(}
{txt}  6{com}.                         qui su `nv'M [weight `exp'] , de
{txt}  7{com}.                         {c )-}
{txt}  8{com}.                 if "`exp'" == "" {c -(}
{txt}  9{com}.                         qui su `nv'M , de
{txt} 10{com}.                         {c )-}
{txt} 11{com}.                 gen `nv'M_B = (`nv'M > r(p50))
{txt} 12{com}.                 
.         // #1-b Factor, 0/1 at median: F
.                 factor z_*
{txt} 13{com}.                 predict `nv'F
{txt} 14{com}.                 su `nv'F , de
{txt} 15{com}.                 gen `nv'F_B = (`nv'F > r(p50))
{txt} 16{com}.                 
.         // #1-c Anderson ('08) wgt'd by Var-Cov mat, 0/1 at median: A
.                 tempname R J T A
{txt} 17{com}.                 mat accum `R' = `varlist' , nocons dev
{txt} 18{com}.                 mat `R' = syminv(`R'/r(N))
{txt} 19{com}.                 mat `J' = J(colsof(`R') , 1 , 1)
{txt} 20{com}. 
.                 local c = 1
{txt} 21{com}.                 while `c' <= colsof(`R') {c -(}
{txt} 22{com}.                         mat `T' = `R'[`c' , 1..colsof(`R')]
{txt} 23{com}.                         mat `A' = `T'*`J'
{txt} 24{com}.                         global wgt`c' = `A'[1 , 1]
{txt} 25{com}.                         local ++c
{txt} 26{com}.                         {c )-}
{txt} 27{com}.                 
.                 tempvar samp1 outp1
{txt} 28{com}.                 gen `samp1' = 0
{txt} 29{com}.                 gen `outp1' = 0
{txt} 30{com}.                 local c = 1
{txt} 31{com}.                 foreach z in `varlist' {c -(}
{txt} 32{com}.                         replace `samp1' = `samp1' + $wgt`c'
{txt} 33{com}.                         replace z_`z' = 0 if missing(`z') 
{txt} 34{com}.                         replace `outp1' = z_`z'*($wgt`c') + `outp1'
{txt} 35{com}.                         local ++c
{txt} 36{com}.                         {c )-}
{txt} 37{com}. 
.                 replace `outp1' = `outp1'/`samp1'
{txt} 38{com}.                 rename `samp1' n_`nv'_var
{txt} 39{com}.                 rename `outp1' `nv'A
{txt} 40{com}. 
.                 su `nv'A , de
{txt} 41{com}.                 gen `nv'A_B = (`nv'A > r(p50))
{txt} 42{com}.                 
.                 local ab M F A
{txt} 43{com}.                 local ful Mean Factor Anderson
{txt} 44{com}.                 forval n = 1/3 {c -(}
{txt} 45{com}.                         local a : word `n' of `ab'
{txt} 46{com}.                         local b : word `n' of `ful'
{txt} 47{com}.                         lab var `nv'`a' "`nv'`a': `nv' `b'"
{txt} 48{com}.                         lab var `nv'`a'_B "`nv'`a'_B: `nv' `b' 0/1"
{txt} 49{com}.                         {c )-}
{txt} 50{com}.                 
.                 drop z_*
{txt} 51{com}.                 macro drop _all
{txt} 52{com}.                 *{c )-}      
. end
{txt}
{com}. 
{txt}end of do-file

{com}. 
. genindex roof_poverty house_poverty electricity, nv(poverty)
{txt}(6412 missing values generated)
(obs=1,370)

Factor analysis/correlation{col 50}Number of obs    = {res}     1,370
{col 5}{txt}Method: principal factors{col 50}Retained factors =   {res}       1
{col 5}{txt}Rotation: (unrotated){col 50}Number of params =   {res}       3

{txt}{col 5}{hline 13}{c TT}{hline 60}
{col 5}     Factor  {c |} {ralign 12:Eigenvalue}   Difference        Proportion   Cumulative
{col 5}{hline 13}{c +}{hline 60}
{col 5}{ralign 11:Factor1}  {c |}{res}      0.48815      0.51039            1.9851       1.9851
{txt}{col 5}{ralign 11:Factor2}  {c |}{res}     -0.02223      0.19778           -0.0904       1.8947
{txt}{col 5}{ralign 11:Factor3}  {c |}{res}     -0.22002            .           -0.8947       1.0000
{txt}{col 5}{hline 13}{c BT}{hline 60}
{col 5}LR test: independent vs. saturated:  chi2({res}3{txt})  ={res}  181.20{txt} Prob>chi2 ={res} 0.0000

{txt}Factor loadings (pattern matrix) and unique variances

{space 4}{hline 13}{c  TT}{hline 10}{c  TT}{hline 14}
{space 4}{space 0}{ralign 12:Variable}{space 1}{c |}{space 1}{ralign 8:Factor1}{space 1}{c |}{space 1}{ralign 12:Uniqueness}{space 1}
{space 4}{hline 13}{c   +}{hline 10}{c   +}{hline 14}
{space 4}{space 0}{ralign 12:z_roof_pov~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf:  0.4668}}}{space 1}{c |}{space 1}{center 12:{res:{sf:    0.7821}}}{space 1}
{space 4}{space 0}{ralign 12:z_house_po~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf:  0.1966}}}{space 1}{c |}{space 1}{center 12:{res:{sf:    0.9613}}}{space 1}
{space 4}{space 0}{ralign 12:z_electric~e}{space 1}{c |}{space 1}{ralign 8:{res:{sf:  0.4812}}}{space 1}{c |}{space 1}{center 12:{res:{sf:    0.7684}}}{space 1}
{space 4}{hline 13}{c  BT}{hline 10}{c  BT}{hline 14}
(regression scoring assumed)

{p 0 0 2}Scoring coefficients (method = regression){p_end}

{space 4}{hline 13}{c  TT}{hline 10}
{space 4}{space 0}{ralign 12:Variable}{space 1}{c |}{space 1}{ralign 8:Factor1}{space 1}
{space 4}{hline 13}{c   +}{hline 10}
{space 4}{space 0}{ralign 12:z_roof_pov~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf: 0.33909}}}{space 1}
{space 4}{space 0}{ralign 12:z_house_po~y}{space 1}{c |}{space 1}{ralign 8:{res:{sf: 0.12862}}}{space 1}
{space 4}{space 0}{ralign 12:z_electric~e}{space 1}{c |}{space 1}{ralign 8:{res:{sf: 0.35363}}}{space 1}
{space 4}{hline 13}{c  BT}{hline 10}


                     Scores for factor 1
{hline 61}
      Percentiles      Smallest
 1%    {res}-.6931067      -1.105848
{txt} 5%    {res}-.6931067      -1.105848
{txt}10%    {res}-.6931067      -1.105848       {txt}Obs         {res}      1,370
{txt}25%    {res}-.6931067      -1.105848       {txt}Sum of Wgt. {res}      1,370

{txt}50%    {res}-.0531497                      {txt}Mean          {res} 3.74e-09
                        {txt}Largest       Std. Dev.     {res} .5947756
{txt}75%    {res} .5868074        2.22437
{txt}90%    {res} .7589313        2.22437       {txt}Variance      {res}  .353758
{txt}95%    {res} .7589313        2.22437       {txt}Skewness      {res} .6070977
{txt}99%    {res} 1.584414        2.22437       {txt}Kurtosis      {res} 2.975696
{txt}(obs=1,370)
(12,526 real changes made)
(11,049 real changes made)
(1,477 real changes made)
(12,526 real changes made)
(7,465 real changes made)
(5,061 real changes made)
(12,526 real changes made)
(6,416 real changes made)
(6,110 real changes made)
(6,114 real changes made)
{res}
                          {txt}povertyA
{hline 61}
      Percentiles      Smallest
 1%    {res}-.6280052       -1.36054
{txt} 5%    {res}-.4121895       -1.36054
{txt}10%    {res}-.4121895       -1.36054       {txt}Obs         {res}     12,526
{txt}25%    {res}-.3460428       -1.36054       {txt}Sum of Wgt. {res}     12,526

{txt}50%    {res}        0                      {txt}Mean          {res}-9.34e-09
                        {txt}Largest       Std. Dev.     {res} .4461729
{txt}75%    {res}        0        2.50518
{txt}90%    {res} .6561891        2.50518       {txt}Variance      {res} .1990703
{txt}95%    {res} .7223359        2.50518       {txt}Skewness      {res} 1.698536
{txt}99%    {res}  2.12126        2.50518       {txt}Kurtosis      {res} 8.498647
{txt}
{com}. 
. replace povertyA=povertyA*-1
{txt}(6,114 real changes made)

{com}. **Higher values of povertyA indicate more poverty (lower income) 
. 
. 
. label variable school1 "School in the community"
{txt}
{com}. label variable borehole1 "Borehole in the community"
{txt}
{com}. label variable clinic1 "Health clinic in the community"
{txt}
{com}. 
. 
. 
. ******
. ** Re-order variables so cleaned vars are at the top
. 
. order commune quartier blid treatment treatment condition incumbent_vote turnout  coethnic female age urban educyears house_ electricity coethnic margin conseil_chef professional jeunes womens_group politique ///
>         information_source1-information_source4 discuss1-discuss3 secret know_village_  ///
>         consequences help goodnewsrelative2 goodnews votedincumbent2011 overall_prior effort_prior corruption_prior p1-p4 ///
>         school1 clinic1 borehole1
{txt}
{com}. 
{txt}end of do-file

{com}.         areg incumbent_vote treatment if goodnews==0, absorb(blid) vce(cluster quartier)

{txt}Linear regression, absorbing indicators{col 49}Number of obs{col 67}= {res}     1,355
{txt}{col 49}F({res}   1{txt},{res}    100{txt}){col 67}= {res}      2.75
{txt}{col 49}Prob > F{col 67}= {res}    0.1004
{txt}{col 49}R-squared{col 67}= {res}    0.2305
{txt}{col 49}Adj R-squared{col 67}= {res}    0.2155
{txt}{col 49}Root MSE{col 67}= {res}    0.4430

{txt}{ralign 78:(Std. Err. adjusted for {res:101} clusters in quartier)}
{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 14}{c |}{col 26}    Robust
{col 1}incumbent_~e{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 3}treatment {c |}{col 14}{res}{space 2}-.0916946{col 26}{space 2} .0552973{col 37}{space 1}   -1.66{col 46}{space 3}0.100{col 54}{space 4} -.201403{col 67}{space 3} .0180138
{txt}{space 7}_cons {c |}{col 14}{res}{space 2} .5647396{col 26}{space 2} .0514103{col 37}{space 1}   10.98{col 46}{space 3}0.000{col 54}{space 4}  .462743{col 67}{space 3} .6667363
{txt}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
        blid {c |}   absorbed                                      (26 categories)

{com}.                                 est store Survey
{txt}
{com}. 
.                 
.                 
.         coefplot Official Survey, vertical  yline(0) keep(treatment)  ///
>         ylabel(, angle(horizontal)) graphr(color(white)) xlabel(, noticks)
{res}{txt}
{com}.         
. cap                     graph export Drafts/JEPS/figures/treatment_badnewsCIs.pdf, as(pdf) replace      
{txt}
{com}. 
.                                 
. *****Appendix
. ** Table G1
. clear
{txt}
{com}. use "merged_administrative_5.dta"
{txt}
{com}. do balance_unmatched-matchedvillages.do
{txt}
{com}. gen unmatched=.
{txt}(5,686 missing values generated)

{com}. replace unmatched=1 if merge2015==1
{txt}(176 real changes made)

{com}. replace unmatched=0 if merge2015==3
{txt}(1,322 real changes made)

{com}. tab unmatched

  {txt}unmatched {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
          0 {c |}{res}      1,322       88.25       88.25
{txt}          1 {c |}{res}        176       11.75      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}      1,498      100.00
{txt}
{com}. 
. tab unmatched dosage if (condition=="" | condition=="control") & survey_sample==0, column
{txt}
{c TLC}{hline 19}{c TRC}
{c |} Key{col 21}{c |}
{c LT}{hline 19}{c RT}
{c |}{space 5}{it:frequency}{col 21}{c |}
{c |}{space 1}{it:column percentage}{col 21}{c |}
{c BLC}{hline 19}{c BRC}

           {c |}        dosage
 unmatched {c |}         0          1 {c |}     Total
{hline 11}{c +}{hline 22}{c +}{hline 10}
         0 {c |}{res}       628        443 {txt}{c |}{res}     1,071 
           {txt}{c |}{res}     83.62      89.86 {txt}{c |}{res}     86.09 
{txt}{hline 11}{c +}{hline 22}{c +}{hline 10}
         1 {c |}{res}       123         50 {txt}{c |}{res}       173 
           {txt}{c |}{res}     16.38      10.14 {txt}{c |}{res}     13.91 
{txt}{hline 11}{c +}{hline 22}{c +}{hline 10}
     Total {c |}{res}       751        493 {txt}{c |}{res}     1,244 
           {txt}{c |}{res}    100.00     100.00 {txt}{c |}{res}    100.00 

{txt}
{com}. 
. ttest dosage, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,322{col 22} .5022693{col 34} .0137567{col 46} .5001841{col 58} .4752819{col 70} .5292566
       {txt}1 {c |}{res}{col 12}    176{col 22} .3011364{col 34} .0346784{col 46} .4600607{col 58} .2326947{col 70}  .369578
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,498{col 22} .4786382{col 34} .0129111{col 46} .4997103{col 58} .4533125{col 70} .5039639
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} .2011329{col 34} .0373073{col 58} .1276312{col 70} .2746347
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  5.3912
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 233.645

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0000          {txt}Pr(T > t) = {res}0.0000
{txt}
{com}. ttest survey_sample, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,322{col 22} .1898638{col 34} .0107907{col 46} .3923417{col 58} .1686951{col 70} .2110326
       {txt}1 {c |}{res}{col 12}    176{col 22} .0170455{col 34} .0097848{col 46} .1298101{col 58} -.002266{col 70} .0363569
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,498{col 22} .1695594{col 34} .0096985{col 46} .3753706{col 58} .1505353{col 70} .1885835
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} .1728184{col 34} .0145664{col 58} .1442205{col 70} .2014162
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} 11.8642
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 718.678

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}1.0000         {txt}Pr(|T| > |t|) = {res}0.0000          {txt}Pr(T > t) = {res}0.0000
{txt}
{com}. 
. ttest inscrits, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,322{col 22} 1053.578{col 34} 49.27179{col 46} 1791.489{col 58} 956.9184{col 70} 1150.237
       {txt}1 {c |}{res}{col 12}    176{col 22} 843.1307{col 34} 58.74319{col 46} 779.3164{col 58} 727.1944{col 70}  959.067
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,498{col 22} 1028.852{col 34} 44.05737{col 46} 1705.197{col 58} 942.4317{col 70} 1115.273
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 210.4472{col 34} 76.67119{col 58} 59.79188{col 70} 361.1026
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  2.7448
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 476.601

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9969         {txt}Pr(|T| > |t|) = {res}0.0063          {txt}Pr(T > t) = {res}0.0031
{txt}
{com}. ttest votants, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,312{col 22} 600.7828{col 34} 17.24824{col 46}  624.758{col 58} 566.9456{col 70} 634.6199
       {txt}1 {c |}{res}{col 12}    174{col 22} 524.9023{col 34} 33.72728{col 46} 444.8934{col 58} 458.3324{col 70} 591.4722
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,486{col 22} 591.8977{col 34}  15.7419{col 46} 606.8294{col 58}  561.019{col 70} 622.7764
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} 75.88048{col 34} 37.88181{col 58} 1.302704{col 70} 150.4582
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  2.0031
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 272.861

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9769         {txt}Pr(|T| > |t|) = {res}0.0462          {txt}Pr(T > t) = {res}0.0231
{txt}
{com}. ttest voteshare_fcbe, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,311{col 22} .7719649{col 34} .3076843{col 46} 11.14055{col 58} .1683571{col 70} 1.375573
       {txt}1 {c |}{res}{col 12}    173{col 22} .3493194{col 34} .0165315{col 46} .2174381{col 58} .3166886{col 70} .3819502
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,484{col 22} .7226942{col 34}  .271833{col 46} 10.47175{col 58} .1894762{col 70} 1.255912
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} .4226455{col 34} .3081281{col 58}-.1818298{col 70} 1.027121
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  1.3717
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 1317.49

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9148         {txt}Pr(|T| > |t|) = {res}0.1704          {txt}Pr(T > t) = {res}0.0852
{txt}
{com}. ttest area, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,322{col 22} .2276853{col 34} .0115375{col 46} .4194971{col 58} .2050514{col 70} .2503192
       {txt}1 {c |}{res}{col 12}    176{col 22} .2840909{col 34} .0340909{col 46}  .452267{col 58} .2168087{col 70} .3513732
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,498{col 22} .2343124{col 34} .0109474{col 46} .4237098{col 58} .2128385{col 70} .2557864
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-.0564056{col 34} .0359903{col 58} -.127341{col 70} .0145298
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -1.5672
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 217.007

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.0593         {txt}Pr(|T| > |t|) = {res}0.1185          {txt}Pr(T > t) = {res}0.9407
{txt}
{com}. ttest participation, by(unmatched)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,312{col 22} 67.58401{col 34}  .789916{col 46} 28.61197{col 58} 66.03437{col 70} 69.13365
       {txt}1 {c |}{res}{col 12}    174{col 22} 68.33925{col 34} 1.733486{col 46} 22.86625{col 58} 64.91775{col 70} 71.76076
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,486{col 22} 67.67244{col 34} .7262131{col 46} 27.99455{col 58} 66.24793{col 70} 69.09696
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-.7552437{col 34} 2.259286{col 58}-5.186978{col 70} 3.676491
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -0.3343
{txt}Ho: diff = 0                                     degrees of freedom = {res}    1484

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.3691         {txt}Pr(|T| > |t|) = {res}0.7382          {txt}Pr(T > t) = {res}0.6309
{txt}
{com}. ttest margin, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,311{col 22} .6066952{col 34} .2981187{col 46}  10.7942{col 58}  .021853{col 70} 1.191537
       {txt}1 {c |}{res}{col 12}    173{col 22} .2254783{col 34} .0149096{col 46} .1961048{col 58}  .196049{col 70} .2549076
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,484{col 22} .5622542{col 34} .2633781{col 46} 10.14604{col 58}  .045621{col 70} 1.078887
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} .3812169{col 34} .2984913{col 58}-.2043536{col 70} .9667874
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  1.2771
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res}  1316.5

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.8991         {txt}Pr(|T| > |t|) = {res}0.2018          {txt}Pr(T > t) = {res}0.1009
{txt}
{com}. ttest competitive_margin, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,309{col 22} .4530176{col 34} .0137639{col 46}  .497978{col 58} .4260159{col 70} .4800192
       {txt}1 {c |}{res}{col 12}    173{col 22} .5202312{col 34} .0380934{col 46} .5010407{col 58} .4450404{col 70}  .595422
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,482{col 22} .4608637{col 34} .0129526{col 46} .4986343{col 58} .4354562{col 70} .4862712
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22}-.0672136{col 34} .0405037{col 58}-.1470399{col 70} .0126127
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res} -1.6594
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 219.349

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.0492         {txt}Pr(|T| > |t|) = {res}0.0985          {txt}Pr(T > t) = {res}0.9508
{txt}
{com}. ttest north_south, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,322{col 22} .4591528{col 34} .0137109{col 46} .4985173{col 58} .4322554{col 70} .4860502
       {txt}1 {c |}{res}{col 12}    176{col 22} .3920455{col 34}  .036905{col 46} .4895996{col 58} .3192094{col 70} .4648815
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,498{col 22} .4512684{col 34} .0128613{col 46} .4977857{col 58} .4260402{col 70} .4764965
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} .0671073{col 34} .0393696{col 58}-.0104709{col 70} .1446856
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  1.7045
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 226.072

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9552         {txt}Pr(|T| > |t|) = {res}0.0897          {txt}Pr(T > t) = {res}0.0448
{txt}
{com}. ttest main_index, by(unmatched) unequal

{txt}Two-sample t test with unequal variances
{hline 9}{c TT}{hline 68}
   Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
       0 {c |}{res}{col 12}  1,322{col 22} 5.193567{col 34} .0603554{col 46} 2.194481{col 58} 5.075164{col 70}  5.31197
       {txt}1 {c |}{res}{col 12}    176{col 22} 4.975822{col 34} .1516141{col 46} 2.011388{col 58} 4.676595{col 70}  5.27505
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}  1,498{col 22} 5.167984{col 34} .0561768{col 46} 2.174265{col 58}  5.05779{col 70} 5.278177
{txt}{hline 9}{c +}{hline 68}
    diff {c |}{res}{col 22} .2177443{col 34} .1631858{col 58}-.1037562{col 70} .5392449
{txt}{hline 9}{c BT}{hline 68}
    diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  1.3343
{txt}Ho: diff = 0                     Satterthwaite's degrees of freedom = {res} 234.081

    {txt}Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0
 Pr(T < t) = {res}0.9083         {txt}Pr(|T| > |t|) = {res}0.1834          {txt}Pr(T > t) = {res}0.0917
{txt}
{com}. 
. 
. gen lg_inscrits = log(inscrits)
{txt}(4,188 missing values generated)

{com}. 
. logit unmatched lg_inscrits voteshare_fcbe area participation competitive_margin main_index north_south

{res}{txt}Iteration 0:{space 3}log likelihood = {res:-534.06404}  
Iteration 1:{space 3}log likelihood = {res:-525.87189}  
Iteration 2:{space 3}log likelihood = {res:-525.72208}  
Iteration 3:{space 3}log likelihood = {res:-525.72204}  
{res}
{txt}Logistic regression{col 49}Number of obs{col 67}= {res}     1,482
{txt}{col 49}LR chi2({res}7{txt}){col 67}= {res}     16.68
{txt}{col 49}Prob > chi2{col 67}= {res}    0.0196
{txt}Log likelihood = {res}-525.72204{txt}{col 49}Pseudo R2{col 67}= {res}    0.0156

{txt}{hline 19}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}         unmatched{col 20}{c |}      Coef.{col 32}   Std. Err.{col 44}      z{col 52}   P>|z|{col 60}     [95% Con{col 73}f. Interval]
{hline 19}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}lg_inscrits {c |}{col 20}{res}{space 2}-.2603697{col 32}{space 2} .1107999{col 43}{space 1}   -2.35{col 52}{space 3}0.019{col 60}{space 4}-.4775336{col 73}{space 3}-.0432059
{txt}{space 4}voteshare_fcbe {c |}{col 20}{res}{space 2} .3928982{col 32}{space 2} .3549859{col 43}{space 1}    1.11{col 52}{space 3}0.268{col 60}{space 4}-.3028615{col 73}{space 3} 1.088658
{txt}{space 14}area {c |}{col 20}{res}{space 2} .3788317{col 32}{space 2} .1860164{col 43}{space 1}    2.04{col 52}{space 3}0.042{col 60}{space 4} .0142462{col 73}{space 3} .7434172
{txt}{space 5}participation {c |}{col 20}{res}{space 2}-.0020335{col 32}{space 2} .0033615{col 43}{space 1}   -0.60{col 52}{space 3}0.545{col 60}{space 4}-.0086218{col 73}{space 3} .0045549
{txt}competitive_margin {c |}{col 20}{res}{space 2} .3032541{col 32}{space 2}  .170965{col 43}{space 1}    1.77{col 52}{space 3}0.076{col 60}{space 4}-.0318311{col 73}{space 3} .6383393
{txt}{space 8}main_index {c |}{col 20}{res}{space 2}-.0362589{col 32}{space 2} .0382565{col 43}{space 1}   -0.95{col 52}{space 3}0.343{col 60}{space 4}-.1112402{col 73}{space 3} .0387225
{txt}{space 7}north_south {c |}{col 20}{res}{space 2}-.2580357{col 32}{space 2} .1887863{col 43}{space 1}   -1.37{col 52}{space 3}0.172{col 60}{space 4}  -.62805{col 73}{space 3} .1119786
{txt}{space 13}_cons {c |}{col 20}{res}{space 2}-.2876964{col 32}{space 2} .8622208{col 43}{space 1}   -0.33{col 52}{space 3}0.739{col 60}{space 4}-1.977618{col 73}{space 3} 1.402225
{txt}{hline 19}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. estimates store unconstrained
{txt}
{com}. logit unmatched if lg_inscrits!=. & voteshare_fcbe!=. & area!=. & participation!=. & competitive_margin!=. & main_index!=. & north_south!=.

{res}{txt}Iteration 0:{space 3}log likelihood = {res:-534.06404}  
Iteration 1:{space 3}log likelihood = {res:-534.06404}  
{res}
{txt}Logistic regression{col 49}Number of obs{col 67}= {res}     1,482
{txt}{col 49}LR chi2({res}0{txt}){col 67}= {res}      0.00
{txt}{col 49}Prob > chi2{col 67}= {res}         .
{txt}Log likelihood = {res}-534.06404{txt}{col 49}Pseudo R2{col 67}= {res}    0.0000

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}   unmatched{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      z{col 46}   P>|z|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 7}_cons {c |}{col 14}{res}{space 2}-2.023727{col 26}{space 2} .0808968{col 37}{space 1}  -25.02{col 46}{space 3}0.000{col 54}{space 4}-2.182282{col 67}{space 3}-1.865172
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. lrtest unconstrained

{txt}Likelihood-ratio test{col 55}LR chi2({res}7{txt}){col 67}={res}     16.68
{txt}(Assumption: {res}{stata est replay .:.}{txt} nested in {res}{stata est replay unconstrained:unconstrained}{txt}){col 55}Prob > chi2 = {res}   0.0196
{txt}
{com}. 
. matrix define hist=J(6, 5, .)
{txt}
{com}. matrix colnames hist = "Mean Unmatched" "Mean Matched" "Difference" "P-Value"    
{txt}
{com}. matrix rownames hist = "Registered Voters (log)" "Urban" "Turnout" "Competitive (dichotomous)" "Incumbent Performance" "North" 
{txt}
{com}. 
. local i = 0                        
{txt}
{com}. foreach var in lg_inscrits area participation competitive_margin main_index north_south {c -(}
{txt}  2{com}.         local i = `i' + 1
{txt}  3{com}.         qui regress `var' unmatched, cluster(commune)
{txt}  4{com}.         local a = _b[_cons] + _b[unmatched]
{txt}  5{com}.         display `a'
{txt}  6{com}.         matrix hist[`i', 1] = round(`a', .01)
{txt}  7{com}.         matrix hist[`i', 2] = round(_b[_cons], .01)
{txt}  8{com}.         matrix hist[`i', 3] = round(abs(_b[unmatched]), .01)
{txt}  9{com}.         matrix temp = r(table)
{txt} 10{com}.         local p = temp[4, 1]
{txt} 11{com}.         display `p'
{txt} 12{com}.         matrix hist[`i', 4] = round(`p', .01)
{txt} 13{com}. 
. {c )-}                          
6.3397665
.089775
.28409091
.14198763
68.339253
.69717504
.52023121
.17050408
4.9758224
.69056465
.39204545
.64881766
{txt}
{com}. 
.                            
. matrix list hist
{res}
{txt}hist[6,5]
              Mean Unmat~d  Mean Matched    Difference       P-Value       P-Value
Registered~) {res}         6.34          6.53           .19           .09             .
{txt}       Urban {res}          .28           .23           .06           .14             .
{txt}     Turnout {res}        68.34         67.58           .76            .7             .
{txt}Competitiv~) {res}          .52           .45           .07           .17             .
{txt}Incumbent ~e {res}         4.98          5.19           .22           .69             .
{txt}       North {res}          .39           .46           .07           .65             .
{reset}
{com}. 
. cap esttab m(hist) using Drafts/Tables/unmatched_balance_admin.tex, replace nomtitle ///
>         addnote("P-values generated from tests in which we cluster on commune.")
{txt}
{com}. 
{txt}end of do-file

{com}. 
. **Table G2
. gen lg_voters = log(regvoters)
{txt}(425 missing values generated)

{com}. *hist lg_voters
. 
. * Change two very high vote margins in low dosage to missing
. replace margin = . if margin > 1
{txt}(2 real changes made, 2 to missing)

{com}. 
. matrix define hist=J(5, 4, .)
{txt}
{com}. matrix colnames hist = "Mean High Dosage" "Mean Low Dosage" "Difference" "P-Value"    
{txt}
{com}. matrix rownames hist = "Registered Voters (log)" "Urban" "Competitive (dichotomous)" ///
>                        "Vote Margin" "Overall Performance" 
{txt}
{com}. 
. local i = 0                        
{txt}
{com}. foreach var in lg_voters area competitive_margin margin main_index {c -(}
{txt}  2{com}.         local i = `i' + 1
{txt}  3{com}.         qui regress `var' dosage, cluster(commune)
{txt}  4{com}.         local a = _b[_cons] + _b[dosage]
{txt}  5{com}.         display `a'
{txt}  6{com}.         matrix hist[`i', 1] = round(`a', .01)
{txt}  7{com}.         matrix hist[`i', 2] = round(_b[_cons], .01)
{txt}  8{com}.         matrix hist[`i', 3] = round(abs(_b[dosage]), .01)
{txt}  9{com}.         matrix temp = r(table)
{txt} 10{com}.         local p = temp[4, 1]
{txt} 11{com}.         display `p'
{txt} 12{com}.         matrix hist[`i', 4] = round(`p', .01)
{txt} 13{com}. 
. {c )-}                          
6.3045303
.17738105
.21199442
.40685646
.42454161
.26947122
.28402231
.19871954
4.9704065
.66554903
{txt}
{com}. 
. tab condition_numeric, gen(tr)

{txt}condition_numeri {c |}
               c {c |}      Freq.     Percent        Cum.
{hline 17}{c +}{hline 35}
Control + Survey {c |}{res}         60       23.62       23.62
{txt}            T1T3 {c |}{res}         45       17.72       41.34
{txt}            T1T4 {c |}{res}         44       17.32       58.66
{txt}            T2T3 {c |}{res}         45       17.72       76.38
{txt}            T2T4 {c |}{res}         60       23.62      100.00
{txt}{hline 17}{c +}{hline 35}
           Total {c |}{res}        254      100.00
{txt}
{com}.                            
. matrix list hist
{res}
{txt}hist[5,4]
              Mean High ~e  Mean Low D~e    Difference       P-Value
Registered~) {res}          6.3          6.52           .22           .18
{txt}       Urban {res}          .21           .25           .04           .41
{txt}Competitiv~) {res}          .42           .49           .07           .27
{txt} Vote Margin {res}          .28           .24           .05            .2
{txt}Overall Pe~e {res}         4.97          5.35           .38           .67
{reset}
{com}. 
. cap esttab m(hist) using Drafts/Tables/dosage_balance_admin.tex, replace nomtitle ///
>         addnote("P-values generated from tests in which we cluster on commune.")
{txt}
{com}.         
. 
. **Table G3
. matrix define hist=J(10, 5, .)
{txt}
{com}. matrix colnames hist = "Control" "Info Only/Private" "Info Only/Public" "Civics/Private" "Civics/Public"   
{txt}
{com}. matrix rownames hist = "Registered Voters (log)" " " "Urban" " " "Competitive (dichotomous)" " " ///
>                        "Vote Margin" " " "Overall Performance" " "
{txt}
{com}.         
. local i = -1    
{txt}
{com}. local j = 0                
{txt}
{com}. foreach var in regvoters area competitive_margin margin main_index {c -(}
{txt}  2{com}.         local i = `i' + 2
{txt}  3{com}.         local j = `j' + 2
{txt}  4{com}. 
.         qui regress `var' tr2-tr5 if dosage==1, cluster(commune)
{txt}  5{com}.         local a1 = _b[_cons] + _b[tr2]
{txt}  6{com}.         local a2 = _b[_cons] + _b[tr3]
{txt}  7{com}.         local a3 = _b[_cons] + _b[tr4]
{txt}  8{com}.         local a4 = _b[_cons] + _b[tr5]
{txt}  9{com}. 
.         display `a'
{txt} 10{com}.         matrix hist[`i', 1] = round(_b[_cons], .01)
{txt} 11{com}.         matrix hist[`i', 2] = round(`a1', .01)
{txt} 12{com}.         matrix hist[`i', 3] = round(`a2', .01)
{txt} 13{com}.         matrix hist[`i', 4] = round(`a3', .01)
{txt} 14{com}.         matrix hist[`i', 5] = round(`a4', .01)
{txt} 15{com}.         
.         matrix temp = r(table)
{txt} 16{com}. 
.         matrix hist[`j', 2] = round(temp[4, 1], .01)
{txt} 17{com}.         matrix hist[`j', 3] = round(temp[4, 2], .01)
{txt} 18{com}.         matrix hist[`j', 4] = round(temp[4, 3], .01)
{txt} 19{com}.         matrix hist[`j', 5] = round(temp[4, 4], .01)
{txt} 20{com}. {c )-}                               
4.9704065
4.9704065
4.9704065
4.9704065
4.9704065
{txt}
{com}.         
. matrix list hist
{res}
{txt}hist[10,5]
                   Control  Info Only/~e  Info Only/~c  Civics/Pri~e  Civics/Pub~c
Registered~) {res}       918.21        835.91       1066.25       1110.73        807.27
{txt}          r2 {res}            .           .38           .52           .27           .34
{txt}       Urban {res}          .31           .31           .34           .27           .29
{txt}          r4 {res}            .             1           .22           .17           .58
{txt}Competitiv~) {res}          .47            .5           .48            .5           .48
{txt}          r6 {res}            .           .54            .9            .6           .87
{txt} Vote Margin {res}          .25           .25           .23           .26           .31
{txt}          r8 {res}            .           .96           .61           .67           .08
{txt}Overall Pe~e {res}         5.23          5.23          5.19          5.23          5.23
{txt}         r10 {res}            .             .           .35             1             .
{reset}
{com}.         
. cap esttab m(hist) using Drafts/Tables/balance_high_dose.tex, replace nomtitle ///
>         addnote("P-values generated from tests in which we cluster on commune.")matrix define hist=J(10, 5, .)
{txt}
{com}. matrix colnames hist = "Control" "Info Only/Private" "Info Only/Public" "Civics/Private" "Civics/Public"   
{txt}
{com}. matrix rownames hist = "Registered Voters (log)" " " "Urban" " " "Competitive (dichotomous)" " " ///
>                        "Vote Margin" " " "Overall Performance" " "
{txt}
{com}.         
. local i = -1    
{txt}
{com}. local j = 0                
{txt}
{com}. foreach var in regvoters area competitive_margin margin main_index {c -(}
{txt}  2{com}.         local i = `i' + 2
{txt}  3{com}.         local j = `j' + 2
{txt}  4{com}. 
.         qui regress `var' tr2-tr5 if dosage==1, cluster(commune)
{txt}  5{com}.         local a1 = _b[_cons] + _b[tr2]
{txt}  6{com}.         local a2 = _b[_cons] + _b[tr3]
{txt}  7{com}.         local a3 = _b[_cons] + _b[tr4]
{txt}  8{com}.         local a4 = _b[_cons] + _b[tr5]
{txt}  9{com}. 
.         display `a'
{txt} 10{com}.         matrix hist[`i', 1] = round(_b[_cons], .01)
{txt} 11{com}.         matrix hist[`i', 2] = round(`a1', .01)
{txt} 12{com}.         matrix hist[`i', 3] = round(`a2', .01)
{txt} 13{com}.         matrix hist[`i', 4] = round(`a3', .01)
{txt} 14{com}.         matrix hist[`i', 5] = round(`a4', .01)
{txt} 15{com}.         
.         matrix temp = r(table)
{txt} 16{com}. 
.         matrix hist[`j', 2] = round(temp[4, 1], .01)
{txt} 17{com}.         matrix hist[`j', 3] = round(temp[4, 2], .01)
{txt} 18{com}.         matrix hist[`j', 4] = round(temp[4, 3], .01)
{txt} 19{com}.         matrix hist[`j', 5] = round(temp[4, 4], .01)
{txt} 20{com}. {c )-}                               
4.9704065
4.9704065
4.9704065
4.9704065
4.9704065
{txt}
{com}.         
. matrix list hist
{res}
{txt}hist[10,5]
                   Control  Info Only/~e  Info Only/~c  Civics/Pri~e  Civics/Pub~c
Registered~) {res}       918.21        835.91       1066.25       1110.73        807.27
{txt}          r2 {res}            .           .38           .52           .27           .34
{txt}       Urban {res}          .31           .31           .34           .27           .29
{txt}          r4 {res}            .             1           .22           .17           .58
{txt}Competitiv~) {res}          .47            .5           .48            .5           .48
{txt}          r6 {res}            .           .54            .9            .6           .87
{txt} Vote Margin {res}          .25           .25           .23           .26           .31
{txt}          r8 {res}            .           .96           .61           .67           .08
{txt}Overall Pe~e {res}         5.23          5.23          5.19          5.23          5.23
{txt}         r10 {res}            .             1           .35             1             1
{reset}
{com}.         
. cap esttab m(hist) using Drafts/Tables/balance_high_dose.tex, replace nomtitle ///
>         addnote("P-values generated from tests in which we cluster on commune.")
{txt}
{com}.         
. **Table G4
. matrix define hist=J(5, 4, .)
{txt}
{com}. matrix colnames hist = "Mean Treatment" "Mean Control" "Difference" "P-Value"    
{txt}
{com}. matrix rownames hist = "Registered Voters (log)" "Urban" "Competitive (dichotomous)" ///
>                        "Vote Margin" "Overall Performance" 
{txt}
{com}. 
. local i = 0                        
{txt}
{com}. foreach var in regvoters area competitive_margin margin main_index {c -(}
{txt}  2{com}.         local i = `i' + 1
{txt}  3{com}.         qui regress `var' treatment if dosage==0
{txt}  4{com}.         local a = _b[_cons] + _b[treatment]
{txt}  5{com}.         display `a'
{txt}  6{com}.         matrix hist[`i', 1] = round(`a', .01)
{txt}  7{com}.         matrix hist[`i', 2] = round(_b[_cons], .01)
{txt}  8{com}.         matrix hist[`i', 3] = round(abs(_b[treatment]), .01)
{txt}  9{com}.         matrix temp = r(table)
{txt} 10{com}.         local p = temp[4, 1]
{txt} 11{com}.         display `p'
{txt} 12{com}.         matrix hist[`i', 4] = round(`p', .01)
{txt} 13{com}. 
. {c )-}                          
933.26667
.89284331
.26666667
.67889707
.53333333
.48143797
.24654733
.98648794
5.420387
1
{txt}
{com}. 
.                            
. matrix list hist
{res}
{txt}hist[5,4]
              Mean Treat~t  Mean Control    Difference       P-Value
Registered~) {res}       933.27        905.87          27.4           .89
{txt}       Urban {res}          .27            .2           .07           .68
{txt}Competitiv~) {res}          .53            .4           .13           .48
{txt} Vote Margin {res}          .25           .25             0           .99
{txt}Overall Pe~e {res}         5.42          5.42             0             1
{reset}
{com}. 
. cap esttab m(hist) using Drafts/Tables/balance_low_dosage.tex, replace nomtitle 
{txt}
{com}. 
. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}J:\jgottlieb\Dropbox\Research\Disseminators\Benin\Drafts\JEPS\AGKM JEPS replication files\JEPS.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res} 5 Nov 2018, 10:49:18
{txt}{.-}
{smcl}
{txt}{sf}{ul off}